Search in sources :

Example 1 with ISecurityManagement

use of org.jboss.security.ISecurityManagement in project wildfly by wildfly.

the class SubjectFactoryService method start.

/** {@inheritDoc} */
@Override
public synchronized void start(StartContext context) throws StartException {
    SecurityLogger.ROOT_LOGGER.debugf("Starting SubjectFactoryService");
    final ISecurityManagement injectedSecurityManagement = securityManagementValue.getValue();
    int i = subjectFactoryClassName.lastIndexOf(":");
    if (i == -1)
        throw SecurityLogger.ROOT_LOGGER.missingModuleName("subject-factory-class-name attribute");
    String moduleSpec = subjectFactoryClassName.substring(0, i);
    String className = subjectFactoryClassName.substring(i + 1);
    JBossSecuritySubjectFactory subjectFactory = null;
    try {
        Class<?> subjectFactoryClazz = SecurityActions.getModuleClassLoader(moduleSpec).loadClass(className);
        subjectFactory = (JBossSecuritySubjectFactory) subjectFactoryClazz.newInstance();
    } catch (Exception e) {
        throw SecurityLogger.ROOT_LOGGER.unableToStartException("SubjectFactoryService", e);
    }
    subjectFactory.setSecurityManagement(injectedSecurityManagement);
    this.subjectFactory = subjectFactory;
}
Also used : JBossSecuritySubjectFactory(org.jboss.security.plugins.JBossSecuritySubjectFactory) ISecurityManagement(org.jboss.security.ISecurityManagement) StartException(org.jboss.msc.service.StartException)

Aggregations

StartException (org.jboss.msc.service.StartException)1 ISecurityManagement (org.jboss.security.ISecurityManagement)1 JBossSecuritySubjectFactory (org.jboss.security.plugins.JBossSecuritySubjectFactory)1