Package org.picketlink.idm.model.basic

Examples of org.picketlink.idm.model.basic.Role


        identityManager.updateCredential( admin, new Password( "admin" ) );
        identityManager.updateCredential( director, new Password( "director" ) );
        identityManager.updateCredential( user, new Password( "user" ) );
        identityManager.updateCredential( guest, new Password( "guest" ) );

        final Role roleAdmin = new Role( "admin" );
        final Role roleAnalyst = new Role( "analyst" );

        identityManager.add( roleAdmin );
        identityManager.add( roleAnalyst );

        relationshipManager.add( new Grant( admin, roleAnalyst ) );
View Full Code Here


    @Override
    public boolean hasRoles(Set<String> roles) {

        if (identity.isLoggedIn()) {
            for (String role : roles) {
                Role retrievedRole = BasicModel.getRole(identityManager, role);
                if (retrievedRole != null && BasicModel.hasRole(partitionManager.createRelationshipManager(), identity.getAccount(), retrievedRole)) {
                    return true;
                }
            }
        }
View Full Code Here

     * @param name Role name
     * @return Users by roles
     */
    @Override
    public List<User> findAllByRole(String name) {
        Role role = BasicModel.getRole(identityManager, name);
        IdentityQuery<User> query = identityManager.createIdentityQuery(User.class);
        query.setParameter(GroupRole.ROLE, role);
        return query.getResultList();
    }
View Full Code Here

     */
    @Override
    public GrantConfiguration roles(String[] roles) {
        list = new ArrayList<Role>();
        for (String role : roles) {
            Role newRole = BasicModel.getRole(identityManager, role);
            if (newRole == null) {
                newRole = new Role(role);
                identityManager.add(newRole);
            }
            list.add(newRole);
        }
        return this;
View Full Code Here

    @Override
    public GrantConfiguration revoke(String... roles) {
        list = new ArrayList<Role>();
        if (identity.isLoggedIn()) {
            for (String role : roles) {
                Role retrievedRole = BasicModel.getRole(identityManager, role);
                if (retrievedRole != null && BasicModel.hasRole(partitionManager.createRelationshipManager(),
                        identity.getAccount(), retrievedRole)) {
                    list.add(retrievedRole);
                }
            }
View Full Code Here

        identityManager.validateCredentials(credentials);

        assertEquals(Credentials.Status.VALID, credentials.getStatus());

        Role role = new Role("ruler");

        identityManager.add(role);

        assertNotNull(BasicModel.getRole(identityManager, role.getName()));
    }
View Full Code Here

        Password password = new Password("abcd1234");

        this.identityManager.updateCredential(user, password);

        Role role = new Role("admin");

        this.identityManager.add(role);

        BasicModel.grantRole(this.relationshipManager, user, role);
View Full Code Here

        identityManager.validateCredentials(credentials);

        assertEquals(Credentials.Status.VALID, credentials.getStatus());

        Role role = new Role("ruler");

        identityManager.add(role);

        assertNotNull(BasicModel.getRole(identityManager, role.getName()));
    }
View Full Code Here

    @InSequence(4)
    public void testRoleManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        String roleName = "admin";
        Role role = getRole(identityManager, roleName);

        if (role != null) {
            identityManager.remove(role);
        }

        identityManager.add(new Role(roleName));

        assertNotNull(getRole(identityManager, roleName));
    }
View Full Code Here

    @InSequence(5)
    public void testRelationshipManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        User user = getUser(identityManager, "johny");
        Role role = getRole(identityManager, "admin");

        RelationshipManager relationshipManager = partitionManager.createRelationshipManager();

        BasicModel.grantRole(relationshipManager, user, role);
View Full Code Here

TOP

Related Classes of org.picketlink.idm.model.basic.Role

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.