public HttpServletHelper(String appContext, Map map, CallbackHandler cbh, String realmName, boolean isSystemApp, String defaultSystemProviderID)
WebBundleDescriptor webBundle = null;
if (map != null) {
webBundle =
(WebBundleDescriptor)map.get(HttpServletConstants.WEB_BUNDLE);
if (webBundle != null) {
LoginConfiguration loginConfig = webBundle.getLoginConfiguration();
if (loginConfig != null &&
LoginConfiguration.CLIENT_CERTIFICATION_AUTHENTICATION.equals(
loginConfig.getAuthenticationMethod())) {
this.realmName = CertificateRealm.AUTH_TYPE;
} else {
this.realmName = realmName;
}
}
}
// set realmName before init
init(GFServerConfigProvider.HTTPSERVLET, appContext,
map, cbh);
if (webBundle != null) {
String policyContextId = WebSecurityManager.getContextID(webBundle);
map.put(HttpServletConstants.POLICY_CONTEXT, policyContextId);
SunWebApp sunWebApp = webBundle.getSunDescriptor();
String pid = (sunWebApp != null ? sunWebApp.getAttributeValue
(sunWebApp.HTTPSERVLET_SECURITY_PROVIDER) : null);
boolean nullConfigProvider = false;
if (isSystemApp && (pid == null || pid.length() == 0)) {
pid = defaultSystemProviderID;
if (pid == null || pid.length() == 0) {
nullConfigProvider = true;
}
}
if (((pid != null && pid.length() > 0) || nullConfigProvider) &&
(!hasExactMatchAuthProvider())) {
AuthConfigProvider configProvider =
((nullConfigProvider)? null :
new GFServerConfigProvider(new HashMap(), null));
String jmacProviderRegisID = factory.registerConfigProvider(
configProvider,
GFServerConfigProvider.HTTPSERVLET, appContext,
"GlassFish provider: " +
GFServerConfigProvider.HTTPSERVLET +
":" + appContext);
this.setJmacProviderRegisID(jmacProviderRegisID);
}
}
|