Search in sources :

Example 1 with IdentityConfigurationBuilder

use of org.picketlink.idm.config.IdentityConfigurationBuilder in project wildfly by wildfly.

the class PartitionManagerAddHandler method createPartitionManagerService.

public void createPartitionManagerService(final OperationContext context, String partitionManagerName, final ModelNode partitionManager, boolean onlyValidate) throws OperationFailedException {
    String jndiName = PartitionManagerResourceDefinition.IDENTITY_MANAGEMENT_JNDI_URL.resolveModelAttribute(context, partitionManager).asString();
    IdentityConfigurationBuilder builder = new IdentityConfigurationBuilder();
    PartitionManagerService partitionManagerService = new PartitionManagerService(partitionManagerName, jndiName, builder);
    ServiceBuilder<PartitionManager> serviceBuilder = null;
    if (!onlyValidate) {
        serviceBuilder = context.getServiceTarget().addService(PartitionManagerService.createServiceName(partitionManagerName), partitionManagerService);
    }
    ModelNode identityConfigurationNode = partitionManager.get(IDENTITY_CONFIGURATION.getName());
    if (!identityConfigurationNode.isDefined()) {
        throw ROOT_LOGGER.idmNoIdentityConfigurationProvided();
    }
    for (Property identityConfiguration : identityConfigurationNode.asPropertyList()) {
        String configurationName = identityConfiguration.getName();
        NamedIdentityConfigurationBuilder namedIdentityConfigurationBuilder = builder.named(configurationName);
        if (!identityConfiguration.getValue().isDefined()) {
            throw ROOT_LOGGER.idmNoIdentityStoreProvided(configurationName);
        }
        List<ModelNode> identityStores = identityConfiguration.getValue().asList();
        for (ModelNode store : identityStores) {
            configureIdentityStore(context, serviceBuilder, partitionManagerService, configurationName, namedIdentityConfigurationBuilder, store);
        }
    }
    if (!onlyValidate) {
        ServiceController<PartitionManager> controller = serviceBuilder.setInitialMode(Mode.PASSIVE).install();
    }
}
Also used : PartitionManager(org.picketlink.idm.PartitionManager) PartitionManagerService(org.wildfly.extension.picketlink.idm.service.PartitionManagerService) IdentityConfigurationBuilder(org.picketlink.idm.config.IdentityConfigurationBuilder) NamedIdentityConfigurationBuilder(org.picketlink.idm.config.NamedIdentityConfigurationBuilder) ModelNode(org.jboss.dmr.ModelNode) NamedIdentityConfigurationBuilder(org.picketlink.idm.config.NamedIdentityConfigurationBuilder) Property(org.jboss.dmr.Property)

Aggregations

ModelNode (org.jboss.dmr.ModelNode)1 Property (org.jboss.dmr.Property)1 PartitionManager (org.picketlink.idm.PartitionManager)1 IdentityConfigurationBuilder (org.picketlink.idm.config.IdentityConfigurationBuilder)1 NamedIdentityConfigurationBuilder (org.picketlink.idm.config.NamedIdentityConfigurationBuilder)1 PartitionManagerService (org.wildfly.extension.picketlink.idm.service.PartitionManagerService)1