Package javax.security.auth.callback

Examples of javax.security.auth.callback.CallbackHandler.handle()


                if (handler != null) {
                    WSPasswordCallback[] cb = { new WSPasswordCallback(user,
                            WSPasswordCallback.KERBEROS_TOKEN) };
                    try {
                        handler.handle(cb);
                        if (cb[0].getPassword() != null && !"".equals(cb[0].getPassword())) {
                            password = cb[0].getPassword();
                            log.debug("Password : " + password);
                        } else {
                            password = passwordFromConfig;
View Full Code Here


            return null;
        }
       
        WSPasswordCallback[] cb = {new WSPasswordCallback(userName, type)};
        try {
            handler.handle(cb);
        } catch (Exception e) {
            policyNotAsserted(info, e);
        }
       
        //get the password
View Full Code Here

       
        WSPasswordCallback wsPasswordCallback =
            new WSPasswordCallback(reqData.getUsername(), WSPasswordCallback.Usage.CUSTOM_TOKEN);
       
        try {
            callbackHandler.handle(new Callback[]{wsPasswordCallback});
        } catch (Exception e) {
            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
                    "empty", e, "WSHandler: password callback failed");
        }
       
View Full Code Here

                LOG.fine("Signature alias is null so using default alias: " + alias);
            }
            // Get the password
            WSPasswordCallback[] cb = {new WSPasswordCallback(alias, WSPasswordCallback.SIGNATURE)};
            LOG.fine("Creating SAML Token");
            callbackHandler.handle(cb);
            String password = cb[0].getPassword();
   
            LOG.fine("Signing SAML Token");
            boolean useKeyValue = signatureProperties.isUseKeyValue();
            assertion.signAssertion(
View Full Code Here

                LOG.fine("Signature alias is null so using default alias: " + alias);
            }
            // Get the password
            WSPasswordCallback[] cb = {new WSPasswordCallback(alias, WSPasswordCallback.SIGNATURE)};
            LOG.fine("Creating SAML Token");
            callbackHandler.handle(cb);
            String password = cb[0].getPassword();
   
            LOG.fine("Signing SAML Token");
            boolean useKeyValue = signatureProperties.isUseKeyValue();
            assertion.signAssertion(
View Full Code Here

      MessageDigest digest = MessageDigest.getInstance("SHA");
      UsernameTokenCallback utc = new UsernameTokenCallback();
      Map options = new HashMap();
      utc.init(options);
      CallbackHandler cbh = new UsernameTokenCallbackHandler(nonce, created);
      cbh.handle((Callback[])options.get("callbacks"));
      utc.preDigest(digest);
      byte[] result = digest.digest(password.getBytes("UTF-8"));
      System.out.println("UsernameToken password digest: " + Base64Encoder.encode(result));
   }
View Full Code Here

           
            WSPasswordCallback[] cb = { new WSPasswordCallback(user,
                    WSPasswordCallback.USERNAME_TOKEN) };
           
            try {
                handler.handle(cb);
               
                //get the password
                String password = cb[0].getPassword();
               
                log.debug("Password : " + password);
View Full Code Here

           
            WSPasswordCallback[] cb = { new WSPasswordCallback(user,
                    WSPasswordCallback.SIGNATURE) };
           
            try {
                handler.handle(cb);
                if(cb[0].getPassword() != null && !"".equals(cb[0].getPassword())) {
                    password = cb[0].getPassword();
                    log.debug("Password : " + password);
                } else {
                    //If there's no password then throw an exception
View Full Code Here

         UsernameTokenCallback callback = new UsernameTokenCallback();
         Map options = new HashMap();
         callback.init(options);
         // add the username token callback handler to provide the parameters
         CallbackHandler handler = new UsernameTokenCallbackHandler(nonce, created);
         handler.handle((Callback[])options.get("callbacks"));
         // calculate the hash and apply the encoding.
         MessageDigest md = MessageDigest.getInstance("SHA");
         callback.preDigest(md);
         md.update(passBytes);
         callback.postDigest(md);
View Full Code Here

            return null;
        }
       
        WSPasswordCallback[] cb = {new WSPasswordCallback(userName, type)};
        try {
            handler.handle(cb);
        } catch (Exception e) {
            policyNotAsserted(info, e);
        }
       
        //get the password
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.