Re: Get the username from UsernameTokens in Skeleton class

2007-07-02 Thread Bryan Carpenter


Another way is outlined at:

  http://wiki.apache.org/ws/FrontPage/WsFx/wss4jFAQ#usernme

An interpretation of this I've been using is:

  import org.apache.axis2.context.MessageContext ;

  import java.util.Vector ;

  import org.apache.ws.security.handler.WSHandlerResult ;
  import org.apache.ws.security.handler.WSHandlerConstants ;

  import org.apache.ws.security.WSSecurityEngineResult ;
  import org.apache.ws.security.util.WSSecurityUtil ;
  import org.apache.ws.security.WSConstants ;
  import org.apache.ws.security.WSUsernameTokenPrincipal ;

  import java.security.Principal;

  [...]

  public String helloUsername() throws Exception {

  MessageContext msgCtx = MessageContext.getCurrentMessageContext() ;

  Vector results =
  (Vector) 
msgCtx.getProperty(WSHandlerConstants.RECV_RESULTS) ;

  // Results for all chained `RampartReceiver' etc handlers.

  WSHandlerResult rResult = (WSHandlerResult) results.get(0) ;
  // Result object for final handler.

  Vector wsResult = rResult.getResults() ;
  // Results for all actions by this handler.

  WSSecurityEngineResult actionResult =
  WSSecurityUtil.fetchActionResult(wsResult, WSConstants.UT) ;
  // Result for `UsernameToken' action.

  Principal principal = actionResult.getPrincipal() ;
  // Principal extracted from `' element.

  WSUsernameTokenPrincipal wsPrincipal =
  (WSUsernameTokenPrincipal) principal ;

  return "Hello " + wsPrincipal.getName() + "!" ;
  }

Bryan


Chad DeBauch wrote:
> I figured out how to do this.  I got the SOAP Envelope from the
> MessageContext by calling getEnvelope() and parsing the SOAP Header for
> the username.  I was hoping there were some helper methods that would do
> that for you but now it is done.
>
> Chad
>
> On 6/21/07, *Chad DeBauch* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> How do I get the username that was in the SOAP UsernameToken from my
> skeleton class?  Is there a way to retrieve it from the
> MessageContext?  I am using Rampart to validate the UsernameTokens
> using a PWCallback class.
>
> Thanks,
>
> Chad
>
>

--

_

Dr David Bryan CarpenterPhone: +44 (0) 23 8059 8814
OMII, University of Southampton FAX  : +44 (0) 23 8059 8870
6005 Faraday Building, Highfield Campus Email: [EMAIL PROTECTED]
Southampton SO17 1BJ, UKURL  : www.hpjava.org
_



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



axis-admin like ant task for Axis2

2007-06-19 Thread Bryan Carpenter


Does Axis2 have any equivalent to the Axis 1  Ant task?

What I want, I suppose, is an Ant task that can upload a ".aar" file
to a running Axis2 server.

Thanks,
Bryan Carpenter

_

Dr David Bryan CarpenterPhone: +44 (0) 23 8059 8814
OMII, University of Southampton FAX  : +44 (0) 23 8059 8870
6005 Faraday Building, Highfield Campus Email: [EMAIL PROTECTED]
Southampton SO17 1BJ, UKURL  : www.hpjava.org
_



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[axis2] Maven plugins for Axis2?

2007-06-15 Thread Bryan Carpenter


Hi

Does anybody know what happened to the Maven plugins for Axis 2 that
are described at:

  http://ws.apache.org/axis2/tools/index.html

?

The "Download Mirrors" page for the jar files just seems to have
dead links.  The parent directories ("apache/ws/axis2/tools/1_2/")
at the mirror sites seem to have archives for other tools, but not
the Maven plugins...

Thanks,
Bryan Carpenter
_______

Dr David Bryan CarpenterPhone: +44 (0) 23 8059 8814
OMII, University of Southampton FAX  : +44 (0) 23 8059 8870
6005 Faraday Building, Highfield Campus Email: [EMAIL PROTECTED]
Southampton SO17 1BJ, UKURL  : www.hpjava.org
_



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]