Results 1 to 5 of 5

Thread: Wss4j - Get Logged Actor

  1. #1
    Join Date
    Sep 2009
    Posts
    8

    Default 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. #2

    Default

    you can get it directly from soap header

  3. #3
    Join Date
    Sep 2009
    Posts
    8

    Default

    How access SOAP Header when using a AbstractMarshallingEndPoint ?

    I can't acces to the MessageContext.

  4. #4

    Default

    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

  5. #5
    Join Date
    Sep 2009
    Posts
    8

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •