FileDocCategorySizeDatePackage
HttpServletHelper.javaAPI DocGlassfish v2 API5570Tue Jul 24 05:01:34 BST 2007com.sun.enterprise.security.jmac.config

HttpServletHelper

public class HttpServletHelper extends ConfigHelper

Fields Summary
private String
realmName
public static final String
AUTH_TYPE
Constructors Summary
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);
                
            }
        }

    
Methods Summary
protected com.sun.enterprise.security.jmac.config.HandlerContextgetHandlerContext(java.util.Map map)

        final String fRealmName = realmName;
        return new HandlerContext() {
            public String getRealmName() {
                return fRealmName;
            }
        };