Package org.picketlink.idm.model.basic

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


    }

    @Test
    @Ignore
    public void testHasRoles() throws Exception {
        Role role = mock(Role.class);
        when(BasicModel.getRole(identityManager, eq("manager"))).thenReturn(role);
//        when(BasicModel.hasRole(any(User.class), eq(role))).thenReturn(true);
        Set<String> roles = new HashSet<String>(Arrays.asList("manager", "developer"));
        assertTrue(identityManagement.hasRoles(roles));
    }
View Full Code Here


            Calendar calendar = expirationDate();
            Password password = new Password(developer.getPassword().toCharArray());

            identityManager.updateCredential(user, password, new Date(), calendar.getTime());

            Role developerRole = BasicModel.getRole(identityManager, UserRoles.DEVELOPER);

            grantRoles(user, developerRole);
            List<User> list = identityManager.createIdentityQuery(User.class)
                    .setParameter(User.LOGIN_NAME, user.getLoginName()).getResultList();
            user = list.get(0);
View Full Code Here

            Calendar calendar = expirationDate();
            Password password = new Password(DEFAULT_PASSWORD.toCharArray());

            identityManager.updateCredential(developerUser, password, new Date(), calendar.getTime());

            Role roleDeveloper = new Role(UserRoles.DEVELOPER);

            identityManager.add(roleDeveloper);

            grantRoles(developerUser, roleDeveloper);
        }

        //Temp hack to add user with admin rights
        User adminUser = BasicModel.getUser(identityManager, DEFAULT_ADMIN);

        // We only create the Admin user, if there is none;
        // if present, there is also no need to apply the same 'Admin' user again.
        if (adminUser == null) {
            adminUser = new User(DEFAULT_ADMIN);
            identityManager.add(adminUser);

            Calendar calendar = expirationDate();
            Password password = new Password(DEFAULT_PASSWORD.toCharArray());

            identityManager.updateCredential(adminUser, password, new Date(), calendar.getTime());

            Role roleAdmin = new Role(UserRoles.ADMIN);

            identityManager.add(roleAdmin);

            grantRoles(adminUser, roleAdmin);
        }
View Full Code Here

    identityManager.add(hacker);
    final Password defaultPassword = new Password("123");
    identityManager.updateCredential(john, defaultPassword);
    identityManager.updateCredential(hacker, defaultPassword);

    Role roleDeveloper = new Role("simple");
    Role roleAdmin = new Role("admin");

    identityManager.add(roleDeveloper);
    identityManager.add(roleAdmin);

    relationshipManager.add(new Grant(john, roleDeveloper));
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.