use of org.picketlink.idm.PartitionManager in project wildfly by wildfly.
the class PartitionManagerService method publishPartitionManager.
private void publishPartitionManager(StartContext context) {
BindInfo bindInfo = createPartitionManagerBindInfo();
ServiceName serviceName = bindInfo.getBinderServiceName();
final BinderService binderService = new BinderService(serviceName.getCanonicalName());
final ServiceBuilder<ManagedReferenceFactory> builder = context.getController().getServiceContainer().addService(serviceName, binderService).addAliases(ContextNames.JAVA_CONTEXT_SERVICE_NAME.append(this.jndiName));
builder.addDependency(ContextNames.JAVA_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector());
builder.addDependency(createServiceName(this.alias), PartitionManager.class, new Injector<PartitionManager>() {
@Override
public void inject(final PartitionManager value) throws InjectionException {
binderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
}
@Override
public void uninject() {
binderService.getManagedObjectInjector().uninject();
}
});
builder.setInitialMode(Mode.PASSIVE).install();
ROOT_LOGGER.boundToJndi("PartitionManager " + this.alias, bindInfo.getAbsoluteJndiName());
}
use of org.picketlink.idm.PartitionManager in project wildfly by wildfly.
the class AbstractBasicIdentityManagementTestCase method testPartitionManagement.
@Test
@InSequence(1)
public void testPartitionManagement() throws Exception {
PartitionManager partitionManager = getPartitionManager();
Realm partition = partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM);
if (partition != null) {
partitionManager.remove(partition);
}
partitionManager.add(new Realm(Realm.DEFAULT_REALM));
assertNotNull(partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM));
}
use of org.picketlink.idm.PartitionManager in project wildfly by wildfly.
the class AbstractBasicIdentityManagementTestCase method testRelationshipManagement.
@Test
@InSequence(5)
public void testRelationshipManagement() throws Exception {
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));
}
use of org.picketlink.idm.PartitionManager in project wildfly by wildfly.
the class CustomCredentialHandlerTestCase method testCustomCredential.
@InSequence(99)
@Test
public void testCustomCredential() {
PartitionManager partitionManager = getPartitionManager();
IdentityManager identityManager = partitionManager.createIdentityManager();
CustomCredential credentials = new CustomCredential("valid_token");
identityManager.validateCredentials(credentials);
assertEquals(Credentials.Status.VALID, credentials.getStatus());
credentials = new CustomCredential("invalid_token");
identityManager.validateCredentials(credentials);
assertEquals(Credentials.Status.INVALID, credentials.getStatus());
}
use of org.picketlink.idm.PartitionManager in project wildfly by wildfly.
the class AbstractBasicIdentityManagementTestCase method testAttributeManagement.
@Test
@InSequence(6)
public void testAttributeManagement() throws Exception {
PartitionManager partitionManager = getPartitionManager();
IdentityManager identityManager = partitionManager.createIdentityManager();
User user = getUser(identityManager, "johny");
assertNull(user.getAttribute("testAttribute"));
user.setAttribute(new Attribute<String>("testAttribute", "value"));
identityManager.update(user);
assertNotNull(user.getAttribute("testAttribute"));
assertEquals("value", user.getAttribute("testAttribute").getValue());
}
Aggregations