• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PartitionManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



PartitionManager类属于org.picketlink.idm包,在下文中一共展示了PartitionManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createDefaultPartition

import org.picketlink.idm.PartitionManager; //导入依赖的package包/类
private void createDefaultPartition(PartitionManager partitionManager) 
 {
    Realm partition = partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM);

    if (partition == null) 
    {
        try 
        {
            partition = new Realm(Realm.DEFAULT_REALM);

            partition.setAttribute(new Attribute<byte[]>("PublicKey", getPublicKey()));
            partition.setAttribute(new Attribute<byte[]>("PrivateKey", getPrivateKey()));

            partitionManager.add(partition);
        } 
        catch (Exception e) 
        {
            throw new SecurityConfigurationException("Could not create default partition.", e);
        }
    }
}
 
开发者ID:forgeide,项目名称:forgeide,代码行数:22,代码来源:SecurityConfiguration.java


示例2: configureDefaultPartition

import org.picketlink.idm.PartitionManager; //导入依赖的package包/类
/**
 * 
 * @param event 
 */
public void configureDefaultPartition(@Observes PartitionManagerCreateEvent event) {
   
    final PartitionManager partitionManager = event.getPartitionManager();
            
    this.checkForDefaultRealm(partitionManager);
    this.checkForDefaultGroups(partitionManager);
    this.checkForDefaultRoles(partitionManager);
    this.checkForDefaultUsers(partitionManager);
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:14,代码来源:SecurityInitializer.java


示例3: configureInternal

import org.picketlink.idm.PartitionManager; //导入依赖的package包/类
/**
 * * Configura o contexto de seguranca do picketlink atraves do evento de 
 * inicializacao do {@link IdentityManager}
 * 
 * @return o gerenciador de particoes do sistema
 */
@Produces
@PicketLink
public PartitionManager configureInternal() {

    final IdentityConfigurationBuilder builder = new IdentityConfigurationBuilder();
    
    builder.named("jpa.config")
            .stores()
            .jpa()
            .supportType(
                    User.class,
                    Role.class,
                    Group.class,
                    Partition.class)
            .supportGlobalRelationship(  
                    Grant.class,  
                    GroupMembership.class)  
            .supportCredentials(true)
            .mappedEntity(
                    RoleTypeEntity.class,
                    UserTypeEntity.class,
                    GrantTypeEntity.class,
                    GroupTypeEntity.class,
                    PasswordTypeEntity.class,
                    PartitionTypeEntity.class,
                    RelationshipTypeEntity.class,
                    GroupMembershipTypeEntity.class,
                    RelationshipIdentityTypeEntity.class)
            .addContextInitializer(this.contextInitializer)
            .setCredentialHandlerProperty(
                    PasswordCredentialHandler.PASSWORD_ENCODER, 
                    new BCryptPasswordEncoder(10));
    
    return new CustomPartitionManager(builder.build());
}
 
开发者ID:arthurgregorio,项目名称:web-budget,代码行数:42,代码来源:SecurityConfiguration.java


示例4: checkForDefaultGroups

import org.picketlink.idm.PartitionManager; //导入依赖的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


示例5: checkForDefaultRoles

import org.picketlink.idm.PartitionManager; //导入依赖的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


示例6: configureDefaultPartition

import org.picketlink.idm.PartitionManager; //导入依赖的package包/类
public void configureDefaultPartition(@Observes PartitionManagerCreateEvent event) 
{
   PartitionManager partitionManager = event.getPartitionManager();

   createDefaultPartition(partitionManager);
}
 
开发者ID:forgeide,项目名称:forgeide,代码行数:7,代码来源:SecurityConfiguration.java


示例7: checkForDefaultRealm

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

    this.defaultRealm = partitionManager.getPartition(
            Realm.class, Realm.DEFAULT_REALM);
    
    if (this.defaultRealm == null) {
        
        this.logger.info("Creating default realm");

        this.defaultRealm = new Realm(Realm.DEFAULT_REALM);
        
        partitionManager.add(this.defaultRealm);
    } 
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:19,代码来源:SecurityInitializer.java


示例8: checkForDefaultUsers

import org.picketlink.idm.PartitionManager; //导入依赖的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.PartitionManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnnotatedDeleteByExampleMethodGenerator类代码示例发布时间:2022-05-22
下一篇:
Java CodeEditUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap