Search in sources :

Example 1 with CallbackHandlerFactory

use of org.jboss.as.domain.management.CallbackHandlerFactory in project wildfly by wildfly.

the class EJBClientDescriptorMetaDataProcessor method getCallbackHandler.

private CallbackHandler getCallbackHandler(final ServiceRegistry serviceRegistry, final String userName, final String securityRealmName) {
    if (securityRealmName != null && !securityRealmName.trim().isEmpty()) {
        final ServiceName securityRealmServiceName = SecurityRealm.ServiceUtil.createServiceName(securityRealmName);
        final ServiceController<SecurityRealm> securityRealmController = (ServiceController<SecurityRealm>) serviceRegistry.getService(securityRealmServiceName);
        if (securityRealmController != null) {
            final SecurityRealm securityRealm = securityRealmController.getValue();
            final CallbackHandlerFactory cbhFactory;
            if (securityRealm != null && (cbhFactory = securityRealm.getSecretCallbackHandlerFactory()) != null && userName != null) {
                return cbhFactory.getCallbackHandler(userName);
            }
        }
    }
    return null;
}
Also used : CallbackHandlerFactory(org.jboss.as.domain.management.CallbackHandlerFactory) ServiceName(org.jboss.msc.service.ServiceName) SecurityRealm(org.jboss.as.domain.management.SecurityRealm) ServiceController(org.jboss.msc.service.ServiceController)

Aggregations

CallbackHandlerFactory (org.jboss.as.domain.management.CallbackHandlerFactory)1 SecurityRealm (org.jboss.as.domain.management.SecurityRealm)1 ServiceController (org.jboss.msc.service.ServiceController)1 ServiceName (org.jboss.msc.service.ServiceName)1