Package org.picketlink.idm

Examples of org.picketlink.idm.RelationshipManager


        }
    }

    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 );

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

        relationshipManager.add( new Grant( director, roleAnalyst ) );

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


        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);

        assertTrue(hasRole(relationshipManager, user, role));
    }
View Full Code Here

   * <p>Loads some users during the first construction.</p>
   */
  @PostConstruct
  public void create() {
    final IdentityManager identityManager = partitionManager.createIdentityManager();
    final RelationshipManager relationshipManager = partitionManager.createRelationshipManager();

    User john = new User("john");

    john.setEmail("john@doe.com");
    john.setFirstName("John");
    john.setLastName("Doe");

    User hacker = new User("hacker");

    hacker.setEmail("hacker@illegal.ru");
    hacker.setFirstName("Hacker");
    hacker.setLastName("anonymous");
   
    identityManager.add(john);
    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));
    relationshipManager.add(new Grant(john, roleAdmin));
  }
View Full Code Here

TOP

Related Classes of org.picketlink.idm.RelationshipManager

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.