Package org.jboss.as.controller.security

Examples of org.jboss.as.controller.security.SubjectUserInfo


                UserInfo userInfo = RemotingContext.getConnection().getUserInfo();
                Principal p = null;
                String credential = null;
                Subject subject = null;
                if (userInfo instanceof SubjectUserInfo) {
                    SubjectUserInfo sinfo = (SubjectUserInfo) userInfo;
                    subject = sinfo.getSubject();

                    Set<PasswordCredential> pcSet = subject.getPrivateCredentials(PasswordCredential.class);
                    if (pcSet.size() > 0) {
                        PasswordCredential pc = pcSet.iterator().next();
                        p = new SimplePrincipal(pc.getUserName());
View Full Code Here


            // For this method to have been called a Subject with HttpPrincipal was not found within the HttpExchange so now
            // create a new one.
            HttpPrincipal principal = ((Success) response).getPrincipal();

            try {
                SubjectUserInfo userInfo = callbackHandler.get().createSubjectUserInfo(principal);
                httpExchange.setAttribute(Subject.class.getName(), userInfo.getSubject(), AttributeScope.CONNECTION);

            } catch (IOException e) {
                ROOT_LOGGER.debug("Unable to create SubjectUserInfo", e);
                response = new Authenticator.Failure(INTERNAL_SERVER_ERROR);
            }
View Full Code Here

            // For this method to have been called a Subject with HttpPrincipal was not found within the HttpExchange so now
            // create a new one.
            HttpPrincipal principal = ((Success) response).getPrincipal();

            try {
                SubjectUserInfo userInfo = callbackHandler.get().createSubjectUserInfo(principal);
                httpExchange.setAttribute(Subject.class.getName(), userInfo.getSubject(), AttributeScope.CONNECTION);

            } catch (IOException e) {
                ROOT_LOGGER.debug("Unable to create SubjectUserInfo", e);
                response = new Authenticator.Failure(INTERNAL_SERVER_ERROR);
            }
View Full Code Here

                // For this method to have been called a Subject with HttpPrincipal was not found within the HttpExchange so now
                // create a new one.
                HttpPrincipal principal = ((Success) response).getPrincipal();

                try {
                    SubjectUserInfo userInfo = authenticationProvider.getCallbackHandler().createSubjectUserInfo(principal);
                    exchange.setAttribute(Subject.class.getName(), userInfo.getSubject(), AttributeScope.CONNECTION);

                } catch (IOException e) {
                    ROOT_LOGGER.debug("Unable to create SubjectUserInfo", e);
                    response = new Authenticator.Failure(INTERNAL_SERVER_ERROR);
                }
View Full Code Here

            HttpPrincipal principal = ((Success) response).getPrincipal();

            try {
                Collection<Principal> principalCol = new HashSet<Principal>();
                principalCol.add(principal);
                SubjectUserInfo userInfo = callbackHandler.get().createSubjectUserInfo(principalCol);
                httpExchange.setAttribute(Subject.class.getName(), userInfo.getSubject(), AttributeScope.CONNECTION);

            } catch (IOException e) {
                ROOT_LOGGER.debug("Unable to create SubjectUserInfo", e);
                response = new Authenticator.Failure(INTERNAL_SERVER_ERROR);
            }
View Full Code Here

            HttpPrincipal principal = ((Success) response).getPrincipal();

            try {
                Collection<Principal> principalCol = new HashSet<Principal>();
                principalCol.add(principal);
                SubjectUserInfo userInfo = callbackHandler.get().createSubjectUserInfo(principalCol);
                httpExchange.setAttribute(Subject.class.getName(), userInfo.getSubject(), AttributeScope.CONNECTION);

            } catch (IOException e) {
                ROOT_LOGGER.debug("Unable to create SubjectUserInfo", e);
                response = new Authenticator.Failure(INTERNAL_SERVER_ERROR);
            }
View Full Code Here

                HttpPrincipal principal = ((Success) response).getPrincipal();

                try {
                    Collection<Principal> principalCol = new HashSet<Principal>();
                    principalCol.add(principal);
                    SubjectUserInfo userInfo = securityRealm.getAuthorizingCallbackHandler(AuthenticationMechanism.CLIENT_CERT)
                            .createSubjectUserInfo(principalCol);
                    exchange.setAttribute(Subject.class.getName(), userInfo.getSubject(), AttributeScope.CONNECTION);

                } catch (IOException e) {
                    ROOT_LOGGER.debug("Unable to create SubjectUserInfo", e);
                    response = new Authenticator.Failure(INTERNAL_SERVER_ERROR);
                }
View Full Code Here

                UserInfo userInfo = SecurityActions.remotingContextGetConnection().getUserInfo();
                Principal p = null;
                String credential = null;
                Subject subject = null;
                if (userInfo instanceof SubjectUserInfo) {
                    SubjectUserInfo sinfo = (SubjectUserInfo) userInfo;
                    subject = sinfo.getSubject();

                    Set<PasswordCredential> pcSet = subject.getPrivateCredentials(PasswordCredential.class);
                    if (pcSet.size() > 0) {
                        PasswordCredential pc = pcSet.iterator().next();
                        p = new SimplePrincipal(pc.getUserName());
                        credential = new String(pc.getCredential());
                        SecurityActions.remotingContextClear(); // Now that it has been used clear it.
                    }
                    if ((p == null || credential == null) && userInfo instanceof UniqueIdUserInfo) {
                        UniqueIdUserInfo uinfo = (UniqueIdUserInfo) userInfo;
                        p = new SimplePrincipal(sinfo.getUserName());
                        credential = uinfo.getId();
                        // In this case we do not clear the RemotingContext as it is still to be used
                        // here extracting the ID just ensures we are not continually calling the modules
                        // for each invocation.
                    }
View Full Code Here

    protected Group[] getRoleSets() throws LoginException {
        Collection<Principal> principalCol = new HashSet<Principal>();
        principalCol.add(new RealmUser(getUsername()));
        try {
            AuthorizingCallbackHandler callbackHandler = getCallbackHandler();
            SubjectUserInfo sui = callbackHandler.createSubjectUserInfo(principalCol);

            SimpleGroup sg = new SimpleGroup("Roles");

            Set<RealmRole> roles = sui.getSubject().getPrincipals(RealmRole.class);
            for (RealmRole current : roles) {
                sg.addMember(createIdentity(current.getName()));
            }

            return new Group[]{sg};
View Full Code Here

                        }
                    }

                    final String userName = subject.getPrincipals(RealmUser.class).iterator().next().getName();

                    return new SubjectUserInfo() {

                        public String getUserName() {
                            return userName;
                        }
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.security.SubjectUserInfo

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.