Package org.apache.ws.security

Examples of org.apache.ws.security.WSPasswordCallback


        }
        LOG.fine("Using Signature algorithm " + sigAlgo);
        ub.queryParam(SSOConstants.SIG_ALG, URLEncoder.encode(sigAlgo, "UTF-8"));
       
        // Get the password
        WSPasswordCallback[] cb = {new WSPasswordCallback(signatureUser, WSPasswordCallback.SIGNATURE)};
        callbackHandler.handle(cb);
        String password = cb[0].getPassword();
       
        // Get the private key
        PrivateKey privateKey = null;
View Full Code Here


     * It attempts to get the password from the private
     * alias/passwords map.
     */
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++) {
            WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];

            String pass = passwords.get(pc.getIdentifer());
            if (pass != null) {
                pc.setPassword(pass);
                return;
            }
        }
    }
View Full Code Here

        public void handle(Callback[] callbacks) throws IOException,
                UnsupportedCallbackException {
            for (int i = 0; i < callbacks.length; i++) {
                if (callbacks[i] instanceof WSPasswordCallback) { // CXF
                    WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
                    if ("eve".equals(pc.getIdentifier())) {
                        pc.setPassword("evekpass");
                        break;
                    }
                }
            }
        }
View Full Code Here

    public static String getCallbackPwd(String userName, int usage, CallbackHandler handler) {
        if (handler == null) {
            return null;
        }
        WSPasswordCallback[] cb = {
            new WSPasswordCallback(userName, usage)
        };
        try {
            handler.handle(cb);
        } catch (Exception e) {
            throw new CryptoProviderException("Cannot get password from callback: " + e, e);
View Full Code Here

public class ServerPasswordCallback implements CallbackHandler {

    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

        WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];

        if (pc.getIdentifer().equals("joe")) {
            pc.setPassword("password");
        }
    }
View Full Code Here

    public void handle(Callback[] callbacks) throws IOException,
            UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++) {
          System.out.println("*** Calling Client UserId/Password Handler .... ");
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
            System.out.println("User Id = " + pwcb.getIdentifer());
            System.out.println("Set Password = " + pwcb.getPassword());
            System.out.println("Usage = " + pwcb.getUsage());
            if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) {
                if ( pwcb.getIdentifer().equals("CalculatorUser")){
                    pwcb.setPassword("CalculatorUserPasswd");
                } else {
                    throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch");
                }
            } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
                if ( pwcb.getIdentifer().equals("CalculatorUser")) {
                    pwcb.setPassword("CalculatorUserPasswd");
                } else {
                    pwcb.setPassword("CalculatorAdmin");
                }
            }
        }
    }
View Full Code Here

    public void handle(Callback[] callbacks) throws IOException,
            UnsupportedCallbackException {
      for (int i = 0; i < callbacks.length; i++) {
            System.out.println("*** Calling Server User/Passwd Handler....");
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
            System.out.println("User Id = " + pwcb.getIdentifer());
            System.out.println("Password = " + pwcb.getPassword());
            System.out.println("Usage = " + pwcb.getUsage());
            if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) {
                if ( pwcb.getIdentifer().equals("CalculatorUser") &&
                        pwcb.getPassword().equals("CalculatorUserPasswd") ){
                            return;
                } else {
                    throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch");
                }
            } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
                if ( pwcb.getIdentifer().equals("CalculatorUser")) {
                    pwcb.setPassword("CalculatorUserPasswd");
                } else {
                    pwcb.setPassword("CalculatorAdmin");
                }
            }
        }
    }
View Full Code Here

    public void handle(Callback[] callbacks) throws IOException,
            UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++) {
          System.out.println("*** Calling Client UserId/Password Handler .... ");
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];

            System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
            System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
            System.out.println(" **** 3. Usage  : " + pwcb.getUsage());
           
            pwcb.setPassword("TuscanyWsUserPasswd");
        }
    }
View Full Code Here

    public void handle(Callback[] callbacks) throws IOException,
            UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++) {
          System.out.println("*** Calling Integrity Password Handler .... ");
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
           
            System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
            System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
            System.out.println(" **** 3. Usage  : " + pwcb.getUsage());
           
            pwcb.setPassword("TuscanyWsUserPasswd");
        }
    }
View Full Code Here

    public void handle(Callback[] callbacks) throws IOException,
            UnsupportedCallbackException {
      for (int i = 0; i < callbacks.length; i++) {
        System.out.println("*** Calling Server User/Passwd Handler....");
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
            System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
            System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
            System.out.println(" **** 3. Usage  : " + pwcb.getUsage());
           
            pwcb.setPassword("TuscanyWsUserPasswd");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.security.WSPasswordCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.