if (metaDataSecurityDomain != null) {
metaDataSecurityDomain = metaDataSecurityDomain.trim();
}
// Get the realm details from the domain model
JBossWebRealm realm = new JBossWebRealm();
String securityDomain = metaDataSecurityDomain == null ? SecurityConstants.DEFAULT_APPLICATION_POLICY : SecurityUtil
.unprefixSecurityDomain(metaDataSecurityDomain);
// Set the current tccl and save it
ClassLoader tcl = SecurityActions.getContextClassLoader();
// Set the Module Class loader as the tccl such that the JNDI lookup of the JBoss Authentication/Authz managers succeed
SecurityActions.setContextClassLoader(classLoader);
try {
AuthenticationManager authM = getAuthenticationManager(securityDomain);
realm.setAuthenticationManager(authM);
AuthorizationManager authzM = getAuthorizationManager(securityDomain);
realm.setAuthorizationManager(authzM);
webContext.setRealm(realm);
} catch (NamingException e1) {
throw new RuntimeException(e1);
} finally {