Announcement Announcement Module
Collapse
No announcement yet.
Wss4j - Get Logged Actor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wss4j - Get Logged Actor

    Hi,

    I've created a spring-ws EndPoint (derived from AbstractMarshallingEndPoint), protected by a wssj4jInterceptor (UserNameToken needed).

    All authentification work's fine, but how can i retrieve the login in my EndPoint ?
    I need to know who's doing the request in the invokeInternal method.

    Thank's for your help.

  • #2
    you can get it directly from soap header

    Comment


    • #3
      How access SOAP Header when using a AbstractMarshallingEndPoint ?

      I can't acces to the MessageContext.

      Comment


      • #4
        One solution is to write endpoint by implementing MessageEndpoint interface and other is to write interceptor.

        Second solution is greate becouse you have access to message context and endpoint object so you can set some properties ( ie. user login ) in endpoint and next get it in that endpoint.

        Code:
        public boolean handleRequest(MessageContext messageContext, Object endpoint)
        HTH

        Comment


        • #5
          It's work.

          I've write my own AbstractMarshallingPayLoadEndPoint, by copy/paste of the original class, and just modifiy the invokeInternal call (in invoke method) for forward the MessageContext.

          The WSS4JInterceptor store the PrincipalName in the message context. The actor name can be retrieve like that :

          Code:
          @SuppressWarnings("unchecked")
          protected String getWSS4JActorLogin(MessageContext context) {		
          	
          		if(context.containsProperty("RECV_RESULTS")) {
          			Vector<Object> results = (Vector<Object>)context.getProperty("RECV_RESULTS") ;
          			for(Object o : results) {
          				if(o instanceof WSHandlerResult) {					
          					WSHandlerResult wsresult = (WSHandlerResult)o ;
          					for(Object y : wsresult.getResults()) {
          						if(y instanceof WSSecurityEngineResult) {
          							WSSecurityEngineResult wssResult = (WSSecurityEngineResult)y ;
          							if(wssResult.get(WSSecurityEngineResult.TAG_PRINCIPAL) != null) {
          								WSUsernameTokenPrincipal token_principal = (WSUsernameTokenPrincipal)wssResult.get(WSSecurityEngineResult.TAG_PRINCIPAL) ;								
          								return token_principal.getName() ;
          							}
          						}						
          					}
          					return wsresult.getActor() ;
          				}
          			}
          			
          		} 		
          		return null ;		 
          	}
          Thank's for your help.

          MMZ

          Comment

          Working...
          X