本文整理汇总了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);
}
}
}
示例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);
}
示例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());
}
示例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"));
}
}
示例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));
}
}
示例6: configureDefaultPartition
import org.picketlink.idm.PartitionManager; //导入依赖的package包/类
public void configureDefaultPartition(@Observes PartitionManagerCreateEvent event)
{
PartitionManager partitionManager = event.getPartitionManager();
createDefaultPartition(partitionManager);
}
示例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);
}
}
示例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));
}
}