configureConfigurationFactory(jettyWebApp, null, securityFactoryData);
moduleContext.addGBean(securityFactoryData);
configureLocalJaspicProvider(new JettyAuthenticationWrapper(authType), contextPath, module, securityFactoryData);
//otherwise rely on pre-configured jaspi
} else {
LoginConfigType loginConfig = loginConfigArray.length == 1? loginConfigArray[0]: null;
GBeanData securityFactoryData = new GBeanData(factoryName, JettySecurityHandlerFactory.class);
configureConfigurationFactory(jettyWebApp, loginConfig, securityFactoryData);
BuiltInAuthMethod auth = BuiltInAuthMethod.NONE;
if (loginConfig != null) {
if (loginConfig.isSetAuthMethod()) {
String authMethod = loginConfig.getAuthMethod().getStringValue().trim();
auth = BuiltInAuthMethod.getValueOf(authMethod);
if (auth == BuiltInAuthMethod.BASIC) {
securityFactoryData.setAttribute("realmName", loginConfig.getRealmName().getStringValue().trim());
} else if (auth == BuiltInAuthMethod.DIGEST) {
securityFactoryData.setAttribute("realmName", loginConfig.getRealmName().getStringValue().trim());
} else if (auth == BuiltInAuthMethod.FORM) {
if (loginConfig.isSetFormLoginConfig()) {
FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
securityFactoryData.setAttribute("loginPage", formLoginConfig.getFormLoginPage().getStringValue());
securityFactoryData.setAttribute("errorPage", formLoginConfig.getFormErrorPage().getStringValue());
}
} else if (auth == BuiltInAuthMethod.CLIENTCERT) {
//nothing to do
} else {
throw new DeploymentException("unrecognized auth method, use jaspi to configure: " + authMethod);
}
} else {
throw new DeploymentException("No auth method configured and no jaspi configured");
}
if (loginConfig.isSetRealmName()) {
webModuleData.setAttribute("realmName", loginConfig.getRealmName().getStringValue());
}
}
securityFactoryData.setAttribute("authMethod", auth);
moduleContext.addGBean(securityFactoryData);
}