Hi Thanks for the prompt reply.
I wanted to know the jar for these classes. However it was a silly mistake
from my side. I have included all jars from Axis2 1.3 distribution but some
how missed wss4j-1.5.3.jar.
Thanks


On Feb 18, 2008 4:36 PM, Sanjay Vivek <[EMAIL PROTECTED]> wrote:

> I was working on this a few weeks back and the complete code listing is
> given below. Cheers.
>
> Sanjay
>
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.context.MessageContext;
> import org.apache.axis2.context.OperationContext;
> import org.apache.axis2.wsdl.WSDLConstants;
> import org.apache.ws.security.WSConstants;
> import org.apache.ws.security.WSSecurityEngineResult;
> import org.apache.ws.security.WSUsernameTokenPrincipal;
> import org.apache.ws.security.handler.WSHandlerConstants;
> import org.apache.ws.security.handler.WSHandlerResult;
>
> import java.util.Vector;
>
> public class PolicyEchoService {
>
>        public String echo() {
>
>        String user=null;
>        String password=null;
>
>        MessageContext msgCtx =
> MessageContext.getCurrentMessageContext();
>        Vector results = null;
>        if ((results = (Vector) msgCtx
>                .getProperty(WSHandlerConstants.RECV_RESULTS)) == null)
> {
>            System.out.println("No security results!!");
>            throw new RuntimeException("No security results!!");
>        } else {
>            System.out.println("Number of results: " + results.size());
>            for (int i = 0; i < results.size(); i++) {
>                WSHandlerResult rResult = (WSHandlerResult)
> results.get(i);
>                Vector wsSecEngineResults = rResult.getResults();
>
>                for (int j = 0; j < wsSecEngineResults.size(); j++) {
>                    WSSecurityEngineResult wser =
> (WSSecurityEngineResult) wsSecEngineResults.get(j);
>                    if (wser.getAction() == WSConstants.UT
>                            && wser.getPrincipal() != null) {
>
>                        //Extract the principal
>                        WSUsernameTokenPrincipal principal =
> (WSUsernameTokenPrincipal)wser.getPrincipal();
>
>                        //Get user/pass
>                        user = principal.getName();
>                        password = principal.getPassword();
>
>                    }
>                }
>            }
>
>            return ("The user was: " + user);
>        }
>
>    }
>
> }
>
>
>
>
> ________________________________
>
>        From: lucky [mailto:[EMAIL PROTECTED]
>        Sent: 18 February 2008 11:00
>        To: [email protected]
>        Subject: User Token details
>
>
>        Hi,
>        I am trying to create a handler and read user name/password
> there to authenticate the Web-Service client. I have used Rampart as
> explained in articles and able to pass username/password as plain text
> and authenticate user. Now I want to capture same details in a handler
> so that it can be invoked for all Web-Services. I am referring to
> article - http://wso2.org/library/169 and trying to get this as below -
>
>        Vector results = null;
>        if ((results = (Vector) msgCtx
>                        .getProperty(WSHandlerConstants.RECV_RESULTS))
> == null) {
>                throw new RuntimeException("No security results!!");
>        } else {
>                for (int i = 0; i < results.size(); i++) {
>
>                        //Get hold of the WSHandlerResult instance
>                        WSHandlerResult rResult = (WSHandlerResult)
> results.get(i);
>                        Vector wsSecEngineResults =
> rResult.getResults();
>
>                        for (int j = 0; j < wsSecEngineResults.size();
> j++) {
>
>                                //Get hold of the WSSecurityEngineResult
> instance
>                                WSSecurityEngineResult wser =
> (WSSecurityEngineResult)
>        wsSecEngineResults.get(j);
>
>                        }
>                }
>        }
>        How ever I am not able to locate
> (WSHandlerConstants.RECV_RESULTS). Can any one please help quickly and
> tell m whch jar to include for this. I am using Axis2 1.3.
>
>        Many Thanks for your time and help
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to