JBoss :: Professional Open Source
import org.jboss.security.SubjectSecurityManager;
InitialContext ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
SubjectSecurityManager ssm = (SubjectSecurityManager) envCtx.lookup("security/security-domain");
If you just want the name, use:
Code:
InitialContext ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
LinkRef ref = (LinkRef) envCtx.lookupLink("security/security-domain");
String secDomain = ref.getLinkName();