Package javax.security.auth.message.callback

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


            try {
                _handler.handle(callbacks);
                if (passwordValidationCallback.getValidator() != null) {
                    result = passwordValidationCallback.getResult();
                    if (result == true) {
                        CallerPrincipalCallback pvCallback = new CallerPrincipalCallback(getSubject(context), username);
                        callbacks = new Callback[]{pvCallback};
                        try {
                            _handler.handle(callbacks);
                        } catch (Exception e) {
                            log.log(Level.SEVERE, LogStringsMessages.WSS_0216_CALLBACKHANDLER_HANDLE_EXCEPTION("CallerPrincipalCallback"),
View Full Code Here


    public void updateOtherPartySubject(
        Subject subject,
        String username,
        String password) {
       
        CallerPrincipalCallback pvCallback = new CallerPrincipalCallback(subject, username);
        Callback[] callbacks = new Callback[] { pvCallback };
        try {
           _handler.handle(callbacks);
        } catch (Exception e) {
            log.log(Level.SEVERE, LogStringsMessages.WSS_0216_CALLBACKHANDLER_HANDLE_EXCEPTION( "CallerPrincipalCallback"),
View Full Code Here

                subject.getPublicCredentials().add(cert);
                return null;
            }
        });
       
        CallerPrincipalCallback pvCallback = new CallerPrincipalCallback(subject,principal);
        Callback[] callbacks = new Callback[] { pvCallback };
        try {
           _handler.handle(callbacks);
        } catch (Exception e) {
            log.log(Level.SEVERE, LogStringsMessages.WSS_0216_CALLBACKHANDLER_HANDLE_EXCEPTION( "CallerPrincipalCallback"),
View Full Code Here

            final GSSName clientCred,
            final GSSCredential gssCred) {
       
        try {
            final KerberosPrincipal kerbPrincipal = new KerberosPrincipal(clientCred.toString());
            CallerPrincipalCallback pvCallback = new CallerPrincipalCallback(subject, kerbPrincipal.getName());
            Callback[] callbacks = new Callback[]{pvCallback};
            _handler.handle(callbacks);
            // adding the KerberosPrincipal to public credentials
            //TODO: check if this needs to be done in case of GF
            AccessController.doPrivileged(new PrivilegedAction<Object>() {
View Full Code Here

    protected boolean setCallerPrincipal(EvasionPrincipal userPrincipal, Subject clientSubject) {
        boolean rvalue = true;


        CallerPrincipalCallback callerPrincipalCallback = new CallerPrincipalCallback(clientSubject, userPrincipal);


        try {

            handler.handle(new Callback[]{callerPrincipalCallback});

            LOGGER.log(Level.FINE, "jmac.caller_principal:" + callerPrincipalCallback.getName() + " "
                    + callerPrincipalCallback.getPrincipal());

        } catch (Exception e) {
            // should not happen
            LOGGER.log(Level.WARNING, "jmac.failed_to_set_caller", e);
            rvalue = false;
View Full Code Here

            } else {
                userPrincipal = p;
            }
        }

        CallerPrincipalCallback callerPrincipalCallback = new CallerPrincipalCallback(clientSubject, userPrincipal);

        if (callerPrincipalCallback.getName() == null && callerPrincipalCallback.getPrincipal() == null) {
            assignGroups = false;
        }

            handler.handle((assignGroups ? new Callback[]{
                        callerPrincipalCallback,
                        new GroupPrincipalCallback(callerPrincipalCallback.getSubject(),
                        assignedGroups)} : new Callback[]{callerPrincipalCallback}));

            LOGGER.log(Level.FINE, "jmac.caller_principal:" + callerPrincipalCallback.getName() + " "
                    + callerPrincipalCallback.getPrincipal());


        return userPrincipal;
    }
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

            }

            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

        }
    }

    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.