Package javax.security.auth.message.callback

Examples of javax.security.auth.message.callback.CallerPrincipalCallback


      //The Authentication process has been a success. We need to register
      //the principal, username, password with the container
      if(result)
      {
         PasswordValidationCallback pvc = cbh.getPasswordValidationCallback();
         CallerPrincipalCallback cpcb = cbh.getCallerPrincipalCallback();
         this.register(request, response, cpcb.getPrincipal(), authMethod,
               pvc.getUsername(), new String(pvc.getPassword()));
      }
     
      return result;
   }
View Full Code Here


        // create a principal with the user and the groups they belong to
        Principal p = new UserGroupPrincipal(userId, groupNames);

        // use a callback to set the principal and groups for this user
        handler.handle(new Callback[] {
                    new CallerPrincipalCallback(s, p),
                    new GroupPrincipalCallback(s, groupNames) });
    }
View Full Code Here

            }

            if (workManager.getCallbackSecurity().getDefaultPrincipal() != null)
            {
               Principal defaultPrincipal = workManager.getCallbackSecurity().getDefaultPrincipal();
               CallerPrincipalCallback cpc =
                  new CallerPrincipalCallback(executionSubject, defaultPrincipal);

               callbacks.add(cpc);
            }

            if (workManager.getCallbackSecurity().getDefaultGroups() != null)
View Full Code Here

        // the authentication process has been a success. We need to register the principal, username, password and roles
        // with the container
        if (result) {
            PasswordValidationCallback pvc = cbh.getPasswordValidationCallback();
            CallerPrincipalCallback cpc = cbh.getCallerPrincipalCallback();

            // get the client principal from the callback.
            Principal clientPrincipal = cpc.getPrincipal();
            if (clientPrincipal == null) {
                clientPrincipal = new SimplePrincipal(cpc.getName());
            }

            // if the client principal is not a jboss generic principal, we need to build one before registering.
            if (!(clientPrincipal instanceof JBossGenericPrincipal))
                clientPrincipal = this.buildJBossPrincipal(clientSubject, clientPrincipal);
View Full Code Here

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

        if (callbacks.length > 0) {
            for (Callback callback : callbacks) {
                if (callback instanceof CallerPrincipalCallback) {
                    CallerPrincipalCallback callerCallback = (CallerPrincipalCallback) callback;
                    if (callerCallback.getPrincipal()  != null)
                        this.callerPrincipalCallback = new CallerPrincipalCallback(callerCallback.getSubject(),
                                callerCallback.getPrincipal());
                    else
                        this.callerPrincipalCallback = new CallerPrincipalCallback(callerCallback.getSubject(),
                                callerCallback.getName());
                } else if (callback instanceof PasswordValidationCallback) {
                    PasswordValidationCallback passCallback = (PasswordValidationCallback) callback;
                    this.passwordValidationCallback = new PasswordValidationCallback(passCallback.getSubject(),
                            passCallback.getUsername(), passCallback.getPassword());
                } else if (callback instanceof GroupPrincipalCallback) {
View Full Code Here

      //The Authentication process has been a success. We need to register
      //the principal, username, password with the container
      if(result)
      {
         PasswordValidationCallback pvc = cbh.getPasswordValidationCallback();
         CallerPrincipalCallback cpcb = cbh.getCallerPrincipalCallback();
         this.register(request, response, cpcb.getPrincipal(), authMethod,
               pvc.getUsername(), new String(pvc.getPassword()));
      }
     
      return result;
   }
View Full Code Here

        
         PasswordValidationCallback passwordValidationCallback =
            new PasswordValidationCallback(null,username,password.toCharArray());  
         cbh.setPasswordValidationCallback(passwordValidationCallback);
        
         cbh.setCallerPrincipalCallback(new CallerPrincipalCallback(null,userPrincipal));
      }
      else
         throw new RuntimeException(" Unsupported Callback handler "
               + this.callbackHandler.getClass().getCanonicalName());
   }
View Full Code Here

                Set<UserIdentity> ids = clientSubject.getPrivateCredentials(UserIdentity.class);
                UserIdentity userIdentity;
                if (ids.size() > 0) {
                    userIdentity = ids.iterator().next();
                } else {
                    CallerPrincipalCallback principalCallback = callbackHandler.getThreadCallerPrincipalCallback();
                    if (principalCallback == null) throw new NullPointerException("No CallerPrincipalCallback");
                    Principal principal = principalCallback.getPrincipal();
                    if (principal == null) {
                        String principalName = principalCallback.getName();
                        Set<Principal> principals = principalCallback.getSubject().getPrincipals();
                        for (Principal p : principals) {
                            if (p.getName().equals(principalName)) {
                                principal = p;
                                break;
                            }
View Full Code Here

                Set<UserIdentity> ids = clientSubject.getPrivateCredentials(UserIdentity.class);
                UserIdentity userIdentity;
                if (ids.size() > 0) {
                    userIdentity = ids.iterator().next();
                } else {
                    CallerPrincipalCallback principalCallback = callbackHandler.getThreadCallerPrincipalCallback();
                    if (principalCallback == null) throw new NullPointerException("No CallerPrincipalCallback");
                    Principal principal = principalCallback.getPrincipal();
                    if (principal == null) {
                        String principalName = principalCallback.getName();
                        Set<Principal> principals = principalCallback.getSubject().getPrincipals();
                        for (Principal p : principals) {
                            if (p.getName().equals(principalName)) {
                                principal = p;
                                break;
                            }
View Full Code Here

            }
        }
    }

    public CallerPrincipalCallback getThreadCallerPrincipalCallback() {
        CallerPrincipalCallback callerPrincipalCallback = callerPrincipals.get();
        callerPrincipals.remove();
        return callerPrincipalCallback;
    }
View Full Code Here

TOP

Related Classes of javax.security.auth.message.callback.CallerPrincipalCallback

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.