protected void configureSecurity(StandardContext geronimoContext, String policyContextId, ConfigurationFactory configurationFactory, Subject defaultSubject, String authMethod, String realmName, String loginPage, String errorPage) {
if (defaultSubject == null) {
defaultSubject = ContextManager.EMPTY;
}
IdentityService identityService = new GeronimoIdentityService(defaultSubject);
UserIdentity unauthenticatedIdentity = identityService.newUserIdentity(defaultSubject);
LoginService loginService = new GeronimoLoginService(configurationFactory, identityService);
Authenticator authenticator;
AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
RegistrationListener listener = new RegistrationListener() {