Package org.switchyard.security.principal

Examples of org.switchyard.security.principal.UserPrincipal


    }

    private SecurityContext getContext() throws Exception {
        SecurityContext context = new DefaultSecurityContext();
        Subject subject = context.getSubject("testSecurityDomain");
        subject.getPrincipals().add(new UserPrincipal("testUser"));
        context.getCredentials().addAll(getCredentials());
        return context;
    }
View Full Code Here


        context.getCredentials().addAll(getCredentials());
        return context;
    }

    private Set<Credential> getCredentials() throws Exception {
        UserPrincipal user = new UserPrincipal("testUser");
        RolePrincipal role = new RolePrincipal("testRole");
        GroupPrincipal parentGroup = new GroupPrincipal("testParentGroup");
        parentGroup.addMember(user);
        GroupPrincipal childGroup = new GroupPrincipal("testChildGroup");
        childGroup.addMember(role);
        parentGroup.addMember(childGroup);
        Set<Credential> creds = new LinkedHashSet<Credential>();
        creds.add(new AssertionCredential(new ElementPuller().pull(new StringReader("<testAssertion/>"))));
        creds.add(SOAPMessageCredentialExtractorTests.getBinarySecurityTokenCertificateCredential());
        creds.add(new ConfidentialityCredential(true));
        creds.add(new ConfidentialityCredential(false));
        creds.add(new NameCredential("testName"));
        creds.add(new PasswordCredential("testPassword"));
        creds.add(new PrincipalCredential(user, true));
        creds.add(new PrincipalCredential(role, false));
        creds.add(new PrincipalCredential(childGroup, true));
        creds.add(new PrincipalCredential(parentGroup, false));
        Subject childSubject = new Subject();
        childSubject.getPrincipals().add(new UserPrincipal("childUser"));
        creds.add(new SubjectCredential(childSubject));
        return creds;
    }
View Full Code Here

        } else {
            Set<Principal> principals = getSubject().getPrincipals();
            String userName = _verifiedCallerCertificate.getSubjectX500Principal().getName();
            // get the CN from the DN.
            userName = userName.substring(userName.indexOf('=') + 1, userName.indexOf(','));
            UserPrincipal authenticatedPrincipal = new UserPrincipal(userName);
            principals.add(authenticatedPrincipal);
            // maybe add roles
            Properties rolesProperties = getRolesProperties();
            if (rolesProperties != null) {
                Set<GroupPrincipal> groups = getSubject().getPrincipals(GroupPrincipal.class);
View Full Code Here

                    MappingResult<Principal> principalResult = new MappingResult<Principal>();
                    principalMapper.setMappingResult(principalResult);
                    principalMapper.performMapping(contextMap, null);
                    Principal principal = principalResult.getMappedObject();
                    if (principal != null) {
                        sts_subject.getPrincipals().add(new UserPrincipal(principal.getName()));
                        sts_mapped = true;
                    }
                    STSGroupMappingProvider rolesMapper = new STSGroupMappingProvider();
                    rolesMapper.init(contextMap);
                    MappingResult<RoleGroup> rolesResult = new MappingResult<RoleGroup>();
View Full Code Here

                if (userPrincipal != null) {
                    credentials.add(new PrincipalCredential(userPrincipal, true));
                }
                String remoteUser = request.getRemoteUser();
                if (remoteUser != null) {
                    credentials.add(new PrincipalCredential(new UserPrincipal(remoteUser), true));
                }
                String charsetName = source.getCharacterEncoding();
                AuthorizationHeaderCredentialExtractor ahce;
                if (charsetName != null) {
                    ahce = new AuthorizationHeaderCredentialExtractor(charsetName);
View Full Code Here

TOP

Related Classes of org.switchyard.security.principal.UserPrincipal

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.