本文整理汇总了Java中org.picketlink.idm.RelationshipManager类的典型用法代码示例。如果您正苦于以下问题:Java RelationshipManager类的具体用法?Java RelationshipManager怎么用?Java RelationshipManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RelationshipManager类属于org.picketlink.idm包,在下文中一共展示了RelationshipManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import org.picketlink.idm.RelationshipManager; //导入依赖的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
示例2: checkAdmin
import org.picketlink.idm.RelationshipManager; //导入依赖的package包/类
/**
* Checks to see if the user is currently logged in to the system by checking the Identity object.
*
* @param servletContext
* the servletContext
* @throws WebApplicationException
* if the user is not authenticated.
*/
public static void checkAdmin(ServletContext servletContext) throws WebApplicationException {
Identity identity = new ServletInjector<Identity>().getManagedBean(servletContext, Identity.class);
IdentityManager identityManager = new ServletInjector<IdentityManager>().getManagedBean(servletContext, IdentityManager.class);
RelationshipManager relationshipManager = new ServletInjector<RelationshipManager>().getManagedBean(servletContext, RelationshipManager.class);
if (identity == null
|| !hasRole(relationshipManager, identity.getAccount(), getRole(identityManager, TankConstants.TANK_GROUP_ADMIN))) {
throw new WebApplicationException(buildForbiddenResponse("Insuficient Rights"));
}
}
开发者ID:intuit,项目名称:Tank,代码行数:19,代码来源:AuthUtil.java
示例3: checkOwner
import org.picketlink.idm.RelationshipManager; //导入依赖的package包/类
/**
* Checks to see if the user is currently logged in to the system by checking the Identity object.
*
* @param servletContext
* the servletContext
* @param ownable
* the entiry to check if the user has rights to
* @throws WebApplicationException
* if the user is not authenticated.
*/
public static void checkOwner(ServletContext servletContext, OwnableEntity ownable) throws WebApplicationException {
checkLoggedIn(servletContext);
Identity identity = new ServletInjector<Identity>().getManagedBean(servletContext, Identity.class);
IdentityManager identityManager = new ServletInjector<IdentityManager>().getManagedBean(servletContext, IdentityManager.class);
RelationshipManager relationshipManager = new ServletInjector<RelationshipManager>().getManagedBean(servletContext, RelationshipManager.class);
if (hasRole(relationshipManager, identity.getAccount(), getRole(identityManager, TankConstants.TANK_GROUP_ADMIN))) {
return;
}
if (StringUtils.isEmpty(ownable.getCreator()) || identity.getAccount().getId().equals(ownable.getCreator())) {
return;
}
throw new WebApplicationException(buildForbiddenResponse("Insufficient Rights"));
}
开发者ID:intuit,项目名称:Tank,代码行数:25,代码来源:AuthUtil.java
示例4: setup
import org.picketlink.idm.RelationshipManager; //导入依赖的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
示例5: setup
import org.picketlink.idm.RelationshipManager; //导入依赖的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
示例6: create
import org.picketlink.idm.RelationshipManager; //导入依赖的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
示例7: createRelationshipManager
import org.picketlink.idm.RelationshipManager; //导入依赖的package包/类
/**
*
* @return
*/
@Override
public RelationshipManager createRelationshipManager() {
return new CustomRelationshipManager(this);
}
开发者ID:arthurgregorio,项目名称:web-budget,代码行数:9,代码来源:CustomPartitionManager.java
示例8: create
import org.picketlink.idm.RelationshipManager; //导入依赖的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.RelationshipManager; //导入依赖的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: checkForDefaultUsers
import org.picketlink.idm.RelationshipManager; //导入依赖的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.RelationshipManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论