Search in sources :

Example 1 with DefaultAuthenticationCacheFactory

use of org.jboss.as.security.plugins.DefaultAuthenticationCacheFactory in project wildfly by wildfly.

the class SecurityDomainJndiInjectable method lookupSecurityDomain.

/**
     * Creates a {@code SecurityDomainContext} if one cannot be found in JNDI for a given security domain
     *
     * @param securityManagement security management
     * @param securityManagerMap security manager map
     * @param securityDomain the name of the security domain
     * @return an instance of {@code SecurityDomainContext}
     * @throws Exception if an error occurs
     */
private SecurityDomainContext lookupSecurityDomain(final JNDIBasedSecurityManagement securityManagement, final ConcurrentHashMap<String, SecurityDomainContext> securityManagerMap, final String securityDomain) throws Exception {
    SecurityDomainContext sdc = securityManagerMap.get(securityDomain);
    if (sdc == null) {
        sdc = securityManagement.createSecurityDomainContext(securityDomain, new DefaultAuthenticationCacheFactory());
        securityManagerMap.put(securityDomain, sdc);
    }
    return sdc;
}
Also used : DefaultAuthenticationCacheFactory(org.jboss.as.security.plugins.DefaultAuthenticationCacheFactory) SecurityDomainContext(org.jboss.as.security.plugins.SecurityDomainContext)

Example 2 with DefaultAuthenticationCacheFactory

use of org.jboss.as.security.plugins.DefaultAuthenticationCacheFactory in project wildfly by wildfly.

the class SecurityDomainService method start.

/** {@inheritDoc} */
@Override
public void start(StartContext context) throws StartException {
    SecurityLogger.ROOT_LOGGER.debugf("Starting SecurityDomainService(%s)", name);
    if (applicationPolicy != null) {
        final ApplicationPolicyRegistration applicationPolicyRegistration = (ApplicationPolicyRegistration) configurationValue.getValue();
        applicationPolicyRegistration.addApplicationPolicy(applicationPolicy.getName(), applicationPolicy);
    }
    final JNDIBasedSecurityManagement securityManagement = (JNDIBasedSecurityManagement) securityManagementValue.getValue();
    AuthenticationCacheFactory cacheFactory = null;
    if ("infinispan".equals(cacheType)) {
        cacheFactory = new InfinispanAuthenticationCacheFactory(cacheManagerValue.getValue(), name);
    } else if ("default".equals(cacheType)) {
        cacheFactory = new DefaultAuthenticationCacheFactory();
    }
    try {
        securityDomainContext = securityManagement.createSecurityDomainContext(name, cacheFactory);
    } catch (Exception e) {
        throw SecurityLogger.ROOT_LOGGER.unableToStartException("SecurityDomainService", e);
    }
    if (jsseSecurityDomain != null) {
        try {
            jsseSecurityDomain.reloadKeyAndTrustStore();
            securityDomainContext.setJSSE(jsseSecurityDomain);
        } catch (Exception e) {
            throw SecurityLogger.ROOT_LOGGER.unableToStartException("SecurityDomainService", e);
        }
    }
    securityManagement.getSecurityManagerMap().put(name, securityDomainContext);
}
Also used : InfinispanAuthenticationCacheFactory(org.jboss.as.security.plugins.InfinispanAuthenticationCacheFactory) DefaultAuthenticationCacheFactory(org.jboss.as.security.plugins.DefaultAuthenticationCacheFactory) InfinispanAuthenticationCacheFactory(org.jboss.as.security.plugins.InfinispanAuthenticationCacheFactory) AuthenticationCacheFactory(org.jboss.as.security.plugins.AuthenticationCacheFactory) DefaultAuthenticationCacheFactory(org.jboss.as.security.plugins.DefaultAuthenticationCacheFactory) ApplicationPolicyRegistration(org.jboss.security.config.ApplicationPolicyRegistration) StartException(org.jboss.msc.service.StartException) JNDIBasedSecurityManagement(org.jboss.as.security.plugins.JNDIBasedSecurityManagement)

Aggregations

DefaultAuthenticationCacheFactory (org.jboss.as.security.plugins.DefaultAuthenticationCacheFactory)2 AuthenticationCacheFactory (org.jboss.as.security.plugins.AuthenticationCacheFactory)1 InfinispanAuthenticationCacheFactory (org.jboss.as.security.plugins.InfinispanAuthenticationCacheFactory)1 JNDIBasedSecurityManagement (org.jboss.as.security.plugins.JNDIBasedSecurityManagement)1 SecurityDomainContext (org.jboss.as.security.plugins.SecurityDomainContext)1 StartException (org.jboss.msc.service.StartException)1 ApplicationPolicyRegistration (org.jboss.security.config.ApplicationPolicyRegistration)1