if (defaultSubject == null) {
defaultSubject = ContextManager.EMPTY;
}
AccessControlContext defaultAcc = ContextManager.registerSubjectShort(defaultSubject, null);
JettyIdentityService identityService = new JettyIdentityService(defaultAcc, defaultSubject, runAsSource);
final LoginService loginService = new JAASLoginService(realmName, new GeronimoLoginService(configurationFactory, identityService));
if (checkRolePermissions) {
return new JaccSecurityHandler(policyContextID, authenticator, loginService, identityService, defaultAcc);
} else {
return new EJBWebServiceSecurityHandler(policyContextID, authenticator, loginService, identityService, defaultAcc);
}