当前位置: 首页>>代码示例>>Java>>正文


Java IdentityManager.add方法代码示例

本文整理汇总了Java中org.picketlink.idm.IdentityManager.add方法的典型用法代码示例。如果您正苦于以下问题:Java IdentityManager.add方法的具体用法?Java IdentityManager.add怎么用?Java IdentityManager.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.picketlink.idm.IdentityManager的用法示例。


在下文中一共展示了IdentityManager.add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
@PostConstruct
public void create() 
{

    // Create user john
    User john = new User("john");
    john.setEmail("[email protected]");
    john.setFirstName("John");
    john.setLastName("User");

    IdentityManager identityManager = this.partitionManager.createIdentityManager();

    identityManager.add(john);
    identityManager.updateCredential(john, new Password("123456"));

}
 
开发者ID:apache,项目名称:deltaspike,代码行数:17,代码来源:Initializer.java

示例2: create

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
public synchronized void create( @Observes PreAuthenticateEvent event ) {
  if ( alreadyDone ) {
    return;
  }

  alreadyDone = true;

  final IdentityManager identityManager = partitionManager.createIdentityManager();
  final RelationshipManager relationshipManager = partitionManager.createRelationshipManager();

  User admin = new User("admin");

  admin.setEmail("[email protected]");
  admin.setFirstName("");
  admin.setLastName("admin");

  User regular = new User("regular");

  regular.setEmail("[email protected]");
  regular.setFirstName("Regular");
  regular.setLastName("User");

  identityManager.add(admin);
  identityManager.add(regular);
  identityManager.updateCredential(admin, new Password("admin"));
  identityManager.updateCredential(regular, new Password("123"));

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

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

  relationshipManager.add(new Grant(admin, roleDeveloper));
  relationshipManager.add(new Grant(admin, roleAdmin));
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:37,代码来源:PicketLinkDefaultUsers.java

示例3: setup

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
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));
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:41,代码来源:PicketLinkDefaultUsers.java

示例4: setup

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
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));
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:33,代码来源:PicketLinkDefaultUsers.java

示例5: create

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
@PostConstruct
public void create() throws Exception{
	Realm cd = new Realm(REALM_CD_NAME);
	Realm storedRealm = partitionManager.getPartition(Realm.class, cd.getName());
	if(storedRealm == null)
	{
		cd.setEnforceSSL(true);
		KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
		cd.setPrivateKey(keyPair.getPrivate().getEncoded());
		cd.setPublickKey(keyPair.getPublic().getEncoded());
		cd.setNumberFailedLoginAttempts(3);
		partitionManager.add(cd);
 
    	IdentityManager cdIdentityManager = partitionManager.createIdentityManager(cd);
    	
        Role Administrator = new Role("Administrator");
        Role Customer = new Role("Customer");
        Role Consumer = new Role("Consumer");
        Role Vendor = new Role("Vendor");
        Role Contacts = new Role("Contacts");
        
        cdIdentityManager.add(Administrator);
        cdIdentityManager.add(Customer);
        cdIdentityManager.add(Consumer);
        cdIdentityManager.add(Vendor);
        cdIdentityManager.add(Contacts);
        
        User user = new User("admin");            
        cdIdentityManager.add(user);
        Password password = new Password("admin");
        cdIdentityManager.updateCredential(user, password); 
        
        RelationshipManager relationshipManager = partitionManager.createRelationshipManager();
        relationshipManager.add(new Grant(user, Administrator));
        
        
        Realm cdcustomer = new Realm(REALM_CDCustomer_NAME);
    	Realm customerRealm = partitionManager.getPartition(Realm.class, cdcustomer.getName());
    	
    	if(customerRealm == null)
    	{
    		cdcustomer.setEnforceSSL(true);
    		KeyPair keyPaircustomer = KeyPairGenerator.getInstance("RSA").generateKeyPair();
    		cdcustomer.setPrivateKey(keyPaircustomer.getPrivate().getEncoded());
    		cdcustomer.setPublickKey(keyPaircustomer.getPublic().getEncoded());
    		cdcustomer.setNumberFailedLoginAttempts(3);
    		partitionManager.add(cdcustomer);
 
        	IdentityManager cdIdentityManagercst = partitionManager.createIdentityManager(cdcustomer);
        	
        	User customer = new User("customer");            
        	cdIdentityManagercst.add(customer);
            Password demo = new Password("demo");
            cdIdentityManagercst.updateCredential(customer, demo); 
            relationshipManager.add(new Grant(customer, Customer));
            
            
            User consumer = new User("consumer");            
        	cdIdentityManagercst.add(consumer);
            cdIdentityManagercst.updateCredential(consumer, demo); 
            relationshipManager.add(new Grant(consumer, Consumer));
    	}
	}
}
 
开发者ID:Contourdynamics,项目名称:smartcommunication,代码行数:65,代码来源:SecurityInitializer.java

示例6: checkForDefaultGroups

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
/**
 * 
 * @param partitionManager 
 */
private void checkForDefaultGroups(PartitionManager partitionManager) {
    
    final IdentityManager identityManager = 
            partitionManager.createIdentityManager(this.defaultRealm);
    
    final IdentityQuery<Group> query = identityManager
            .createIdentityQuery(Group.class);

    query.setParameter(Group.NAME, "Administradores");

    final List<Group> groups = query.getResultList();
    
    if (groups.isEmpty()) {
        
        this.logger.info("Creating default groups");
        
        identityManager.add(new Group("Administradores"));
    }
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:24,代码来源:SecurityInitializer.java

示例7: checkForDefaultRoles

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
/**
 * 
 * @param partitionManager 
 */
private void checkForDefaultRoles(PartitionManager partitionManager) {
    
    final IdentityManager identityManager = 
            partitionManager.createIdentityManager(this.defaultRealm);
    
    final IdentityQuery<Role> query = identityManager
            .createIdentityQuery(Role.class);

    query.setParameter(Role.NAME, ApplicationRoles.ADMINISTRATOR);

    List<Role> roles = query.getResultList();
    
    if (roles.isEmpty()) {
        
        this.logger.info("Creating default roles");
        
        identityManager.add(new Role(ApplicationRoles.ADMINISTRATOR));
    }
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:24,代码来源:SecurityInitializer.java

示例8: create

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
/**
 * Creates example users so people can log in while trying out the app.
 */
public synchronized void create(@Observes PreAuthenticateEvent event) {
    if (done) {
        return;
    }

    done = true;

    final IdentityManager identityManager = partitionManager.createIdentityManager();
    final RelationshipManager relationshipManager = partitionManager.createRelationshipManager();

    User admin = new User("admin");

    admin.setEmail("[email protected]");
    admin.setFirstName("John");
    admin.setLastName("Doe");

    User nonAdmin = new User("joe");

    nonAdmin.setEmail("[email protected]");
    nonAdmin.setFirstName("Joe");
    nonAdmin.setLastName("Doe");

    identityManager.add(admin);
    identityManager.add(nonAdmin);
    identityManager.updateCredential(admin,
                                     new Password("admin"));
    identityManager.updateCredential(nonAdmin,
                                     new Password("joe"));

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

    identityManager.add(roleSimple);
    identityManager.add(roleAdmin);

    relationshipManager.add(new Grant(admin,
                                      roleSimple));
    relationshipManager.add(new Grant(admin,
                                      roleAdmin));

    relationshipManager.add(new Grant(nonAdmin,
                                      roleSimple));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:47,代码来源:PicketLinkDefaultUsers.java

示例9: create

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
/**
 * Creates example users so people can log in while trying out the app.
 */
public synchronized void create(@Observes PreAuthenticateEvent event) {
    if (done) {
        return;
    }

    done = true;

    final IdentityManager identityManager = partitionManager.createIdentityManager();
    final RelationshipManager relationshipManager = partitionManager.createRelationshipManager();

    User admin = new User("admin");

    admin.setEmail("[email protected]");
    admin.setFirstName("John");
    admin.setLastName("Doe");

    User nonAdmin = new User("joe");

    nonAdmin.setEmail("[email protected]");
    nonAdmin.setFirstName("Joe");
    nonAdmin.setLastName("Doe");

    identityManager.add(admin);
    identityManager.add(nonAdmin);
    identityManager.updateCredential(admin,
                                     new Password("admin"));
    identityManager.updateCredential(nonAdmin,
                                     new Password("123"));

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

    identityManager.add(roleSimple);
    identityManager.add(roleAdmin);

    relationshipManager.add(new Grant(admin,
                                      roleSimple));
    relationshipManager.add(new Grant(admin,
                                      roleAdmin));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:44,代码来源:PicketLinkDefaultUsers.java

示例10: create

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
@PostConstruct
public void create()
{
   if (partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM) == null)
   {
      partitionManager.add(new Realm(Realm.DEFAULT_REALM));
   }

   IdentityManager im = partitionManager.createIdentityManager();
   User u = new User();

   u.setFirstName("Shane");
   u.setLastName("Bryzak");
   u.setUsername("sbryzak");
   im.add(u);
   im.updateCredential(u, new Password("password"));

   Project p = new Project();
   p.setName("Meeting Planner");
   p.setDescription("Simplified meeting and event planning, provides comprehensive features for venue, resource and attendee management.");
   p.setStage("Dev");
   p.setImageUrl("images/planner.jpg");
   p.setUpdates(16);
   p.setViews(3);
   entityManager.persist(p);

   ProjectAccess pa = new ProjectAccess();
   pa.setProject(p);
   pa.setAccessLevel(AccessLevel.OWNER);
   pa.setUserId(u.getId());

   entityManager.persist(pa);

   p = new Project();
   p.setName("Customer Directory");
   p.setDescription("Basic customer contact directory, with highly customisable attributes and RESTful interface for managing and querying entities.");
   p.setStage("Production");
   p.setImageUrl("images/directory.jpg");
   p.setUpdates(73);
   p.setViews(22);
   entityManager.persist(p);

   pa = new ProjectAccess();
   pa.setProject(p);
   pa.setAccessLevel(AccessLevel.OWNER);
   pa.setUserId(u.getId());

   entityManager.persist(pa);
}
 
开发者ID:forgeide,项目名称:forgeide,代码行数:50,代码来源:IDMInitializer.java

示例11: checkForDefaultUsers

import org.picketlink.idm.IdentityManager; //导入方法依赖的package包/类
/**
 * 
 * @param partitionManager 
 */
private void checkForDefaultUsers(PartitionManager partitionManager) {

    final IdentityManager identityManager = 
            partitionManager.createIdentityManager(this.defaultRealm);
    
    final IdentityQuery<User> query = identityManager
            .createIdentityQuery(User.class);

    query.setParameter(User.USER_NAME, "admin");

    List<User> users = query.getResultList();
    
    if (users.isEmpty()) {
        
        this.logger.info("Creating default users");
        
        final User user = new User("admin", new Person(
                "Administrador", "[email protected]"));
        
        user.setCreatedDate(new Date());
        user.setEnabled(true);
        user.setExpirationDate(null);
        
        identityManager.add(user);

        identityManager.updateCredential(user, new Password("admin"));
        
        final RelationshipManager relationshipManager = 
                partitionManager.createRelationshipManager();
        
        final IdentityQuery<Role> roleQuery = 
                identityManager.createIdentityQuery(Role.class);

        roleQuery.setParameter(Role.NAME, ApplicationRoles.ADMINISTRATOR);
        
        final Role administratorRole = roleQuery.getResultList().get(0);
        
        relationshipManager.add(new Grant(user, administratorRole));
    }
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:45,代码来源:SecurityInitializer.java


注:本文中的org.picketlink.idm.IdentityManager.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。