use of org.jboss.msc.service.ServiceContainer in project wildfly by wildfly.
the class ElytronSecurityIntegration method createCallbackHandler.
@Override
public CallbackHandler createCallbackHandler(final Callback callback) {
assert callback != null;
// TODO switch to use the elytron security domain once the callback has that info available.
final String securityDomainName = callback.getDomain();
// get domain reference from the service container and create the callback handler using the domain.
if (securityDomainName != null) {
final ServiceContainer container = this.currentServiceContainer();
final ServiceName securityDomainServiceName = SECURITY_DOMAIN_RUNTIME_CAPABILITY.getCapabilityServiceName(securityDomainName);
final SecurityDomain securityDomain = (SecurityDomain) container.getRequiredService(securityDomainServiceName).getValue();
return new ElytronCallbackHandler(securityDomain, callback);
}
// TODO use subsystem logger for the exception.
throw ConnectorLogger.ROOT_LOGGER.invalidCallbackSecurityDomain();
}
use of org.jboss.msc.service.ServiceContainer in project wildfly by wildfly.
the class ElytronSubjectFactory method createSubject.
/**
* {@inheritDoc}
*/
public Subject createSubject(final String authenticationContextName) {
AuthenticationContext context;
if (authenticationContextName != null && !authenticationContextName.isEmpty()) {
final ServiceContainer container = this.currentServiceContainer();
final ServiceName authContextServiceName = AUTHENTICATION_CONTEXT_RUNTIME_CAPABILITY.getCapabilityServiceName(authenticationContextName);
context = (AuthenticationContext) container.getRequiredService(authContextServiceName).getValue();
} else {
context = getAuthenticationContext();
}
final Subject subject = this.createSubject(context);
if (ROOT_LOGGER.isTraceEnabled()) {
ROOT_LOGGER.subject(subject, Integer.toHexString(System.identityHashCode(subject)));
}
return subject;
}
use of org.jboss.msc.service.ServiceContainer in project wildfly by wildfly.
the class InfinispanCacheDeploymentListener method startCache.
@Override
public Wrapper startCache(Classification classification, Properties properties) throws Exception {
String cache_type = properties.getProperty(CACHE_TYPE);
String container = properties.getProperty(CONTAINER);
// TODO Figure out how to access CapabilityServiceSupport from here
ServiceName containerServiceName = ServiceName.parse(InfinispanRequirement.CONTAINER.resolve(container));
EmbeddedCacheManager embeddedCacheManager;
ServiceName serviceName;
if (CACHE_PRIVATE.equals(cache_type)) {
// need a private cache for non-jpa application use
String name = properties.getProperty(NAME);
serviceName = ServiceName.JBOSS.append(DEFAULT_CACHE_CONTAINER, (name != null) ? name : UUID.randomUUID().toString());
ServiceContainer target = currentServiceContainer();
// Create a mock service that represents this session factory instance
ServiceBuilder<EmbeddedCacheManager> builder = new AliasServiceBuilder<>(serviceName, containerServiceName, EmbeddedCacheManager.class).build(target).setInitialMode(ServiceController.Mode.ACTIVE);
embeddedCacheManager = ServiceContainerHelper.getValue(builder.install());
} else {
// need a shared cache for jpa applications
serviceName = containerServiceName;
ServiceRegistry registry = currentServiceContainer();
embeddedCacheManager = (EmbeddedCacheManager) registry.getRequiredService(serviceName).getValue();
}
return new CacheWrapper(embeddedCacheManager, serviceName);
}
use of org.jboss.msc.service.ServiceContainer in project wildfly by wildfly.
the class ModClusterResource method service.
static ModClusterService service(String name) {
final ServiceContainer serviceContainer = CurrentServiceContainer.getServiceContainer();
if (serviceContainer == null) {
//for tests
return null;
}
ServiceController<?> cluster = serviceContainer.getService(UndertowService.FILTER.append(name));
if (cluster == null) {
return null;
}
return (ModClusterService) cluster.getService();
}
Aggregations