Package org.picketlink.idm.model.basic

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


    private void setup() {
        final IdentityManager identityManager = partitionManager.createIdentityManager();
        final RelationshipManager relationshipManager = partitionManager.createRelationshipManager();

        final User admin = new User( "admin" );
        final User director = new User( "director" );
        final User user = new User( "user" );
        final User guest = new User( "guest" );

        identityManager.add( admin );
        identityManager.add( director );
        identityManager.add( user );
        identityManager.add( guest );
View Full Code Here


     * @param username
     * @return User
     */
    @Override
    public User findByUsername(String username) throws RuntimeException {
        User user = BasicModel.getUser(identityManager, username);
        if (user == null) {
            throw new AeroGearSecurityException(HttpStatus.CREDENTIAL_NOT_FOUND);
        }
        return user;
    }
View Full Code Here

     */
    @Produces
    @Secret
    public String getSecret() {

        User user = (User) identity.getAccount();

        Attribute<String> secret = user.getAttribute(IDM_SECRET_ATTRIBUTE);

        if (secret == null) {
            secret = new Attribute<String>(IDM_SECRET_ATTRIBUTE, Base32.random());
            user.setAttribute(secret);
            this.identityManager.update(user);
        }
        return secret.getValue();
    }
View Full Code Here

     * @param username represents a simple user's implementation to hold credentials.
     */
    @Override
    public void to(String username) {

        User picketLinkUser = BasicModel.getUser(identityManager, username);

        for (Role role : list) {
            BasicModel.grantRole(partitionManager.createRelationshipManager(), picketLinkUser, role);
        }

View Full Code Here

            this.partitionManager.add(defaultRealm);
        }

        IdentityManager identityManager = this.partitionManager.createIdentityManager();

        User user = new User("mary");

        identityManager.add(user);

        assertNotNull(BasicModel.getUser(identityManager, user.getLoginName()));

        Password password = new Password("abcd1234");

        identityManager.updateCredential(user, password);

        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(user.getLoginName(), password);

        identityManager.validateCredentials(credentials);

        assertEquals(Credentials.Status.VALID, credentials.getStatus());
View Full Code Here

    }

    @Test
    @InSequence(2)
    public void testAuthentication() {
        User user = new User("johny");

        this.identityManager.add(user);

        Password password = new Password("abcd1234");
View Full Code Here

            this.partitionManager.add(defaultRealm);
        }

        IdentityManager identityManager = this.partitionManager.createIdentityManager();

        User user = new User("mary");

        identityManager.add(user);

        assertNotNull(BasicModel.getUser(identityManager, user.getLoginName()));

        Password password = new Password("abcd1234");

        identityManager.updateCredential(user, password);

        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(user.getLoginName(), password);

        identityManager.validateCredentials(credentials);

        assertEquals(Credentials.Status.VALID, credentials.getStatus());
View Full Code Here

    @InSequence(2)
    public void testUserManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        String loginName = "johny";
        User user = getUser(identityManager, loginName);

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

        identityManager.add(new User(loginName));

        assertNotNull(getUser(identityManager, loginName));
    }
View Full Code Here

    @Test
    @InSequence(3)
    public void testCredentialManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        User user = getUser(identityManager, "johny");
        Password password = new Password("abcd1234");

        identityManager.updateCredential(user, password);

        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(user.getLoginName(), password);

        identityManager.validateCredentials(credentials);

        assertEquals(Credentials.Status.VALID, credentials.getStatus());
    }
View Full Code Here

    @Test
    @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.User

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.