Search in sources :

Example 1 with IdentityProviderService

use of org.wildfly.extension.picketlink.federation.service.IdentityProviderService in project wildfly by wildfly.

the class FederationDependencyProcessor method getFederationService.

private ServiceName getFederationService(DeploymentPhaseContext phaseContext) {
    DeploymentUnit deployment = phaseContext.getDeploymentUnit();
    ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
    // We assume the mgmt ops that trigger IdentityProviderAddHandler or ServiceProviderAddHandler
    // run before the OperationStepHandler that triggers deploy. If not, that's a user mistake.
    // Since those handlers run first, we can count on MSC having services *registered* even
    // though we cannot count on them being *started*.
    ServiceController<?> service = serviceRegistry.getService(IdentityProviderService.createServiceName(deployment.getName()));
    if (service == null) {
        service = serviceRegistry.getService(ServiceProviderService.createServiceName(deployment.getName()));
    } else {
        IdentityProviderService identityProviderService = (IdentityProviderService) service.getService();
        IDPConfiguration idpType = identityProviderService.getValue().getConfiguration();
        if (idpType.isExternal()) {
            return null;
        }
    }
    if (service == null) {
        return null;
    }
    return service.getName();
}
Also used : IDPConfiguration(org.wildfly.extension.picketlink.federation.config.IDPConfiguration) IdentityProviderService(org.wildfly.extension.picketlink.federation.service.IdentityProviderService) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 2 with IdentityProviderService

use of org.wildfly.extension.picketlink.federation.service.IdentityProviderService in project wildfly by wildfly.

the class IdentityProviderAddHandler method launchServices.

static void launchServices(OperationContext context, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers, PathAddress pathAddress, boolean isRestart) throws OperationFailedException {
    String alias = pathAddress.getLastElement().getValue();
    IdentityProviderService service = new IdentityProviderService(toIDPConfig(context, model, alias));
    ServiceBuilder<IdentityProviderService> serviceBuilder = context.getServiceTarget().addService(IdentityProviderService.createServiceName(alias), service);
    String federationAlias = pathAddress.subAddress(0, pathAddress.size() - 1).getLastElement().getValue();
    serviceBuilder.addDependency(FederationService.createServiceName(federationAlias), FederationService.class, service.getFederationService());
    configureHandler(context, model, service);
    IDPConfiguration configuration = service.getConfiguration();
    if (!configuration.isExternal()) {
        serviceBuilder.addDependency(SecurityDomainService.SERVICE_NAME.append(configuration.getSecurityDomain()));
    }
    if (verificationHandler != null) {
        serviceBuilder.addListener(verificationHandler);
    }
    ServiceController<IdentityProviderService> controller = serviceBuilder.install();
    if (newControllers != null) {
        newControllers.add(controller);
    }
    if (isRestart) {
        restartTrustDomains(alias, model, context);
    }
}
Also used : IDPConfiguration(org.wildfly.extension.picketlink.federation.config.IDPConfiguration) IdentityProviderService(org.wildfly.extension.picketlink.federation.service.IdentityProviderService)

Aggregations

IDPConfiguration (org.wildfly.extension.picketlink.federation.config.IDPConfiguration)2 IdentityProviderService (org.wildfly.extension.picketlink.federation.service.IdentityProviderService)2 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)1