Package org.switchyard.security.principal

Examples of org.switchyard.security.principal.RolePrincipal


        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);
View Full Code Here


            Properties rolesProperties = getRolesProperties();
            if (rolesProperties != null) {
                Set<GroupPrincipal> groups = getSubject().getPrincipals(GroupPrincipal.class);
                Set<String> roleNames = Strings.uniqueSplitTrimToNull(rolesProperties.getProperty(userName), ",");
                for (String roleName : roleNames) {
                    RolePrincipal role = new RolePrincipal(roleName);
                    if (groups.isEmpty()) {
                        GroupPrincipal rolesGroup = new GroupPrincipal(GroupPrincipal.ROLES);
                        rolesGroup.addMember(role);
                        getSubject().getPrincipals().add(rolesGroup);
                    } else {
View Full Code Here

                        GroupPrincipal roles = null;
                        for (Role role : roleGroup.getRoles()) {
                            if (roles == null) {
                                roles = new GroupPrincipal(GroupPrincipal.ROLES);
                            }
                            roles.addMember(new RolePrincipal(role.getRoleName()));
                        }
                        if (roles != null) {
                            sts_subject.getPrincipals().add(roles);
                            sts_mapped = true;
                        }
View Full Code Here

                    }
                    if (toRolesGroup == fromRolesGroup) {
                        continue;
                    }
                    for (Principal fromRole : Collections.list(fromRolesGroup.members())) {
                        RolePrincipal toRole = fromRole instanceof RolePrincipal ? (RolePrincipal)fromRole : new RolePrincipal(fromRole.getName());
                        toRolesGroup.addMember(toRole);
                    }
                } else {
                    toPrincipals.add(fromPrincipal);
                }
View Full Code Here

        T t = null;
        final String securityDomain = serviceSecurity.getSecurityDomain();
        final Subject subject = securityContext.getSubject(securityDomain);
        final Principal principal = securityContext.getCallerPrincipal(securityDomain);
        final Group rolesGroup = getRolesGroup(subject);
        RolePrincipal runAsPrincipal = null;
        boolean runAsAdded = false;
        final String runAs = serviceSecurity.getRunAs();
        if (runAs != null) {
            runAsPrincipal = new RolePrincipal(runAs);
            if (!rolesGroup.isMember(runAsPrincipal)) {
                rolesGroup.addMember(runAsPrincipal);
                runAsAdded = true;
            }
        }
View Full Code Here

TOP

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

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.