/// <summary>Returns the filtered configuration (only properties starting with the specified prefix). /// </summary> /// <remarks> /// Returns the filtered configuration (only properties starting with the specified prefix). The property keys /// are also trimmed from the prefix. The returned /// <see cref="Properties"/> /// object is used to initialized the /// <see cref="AuthenticationHandler"/> /// . /// <p> /// This method can be overriden by subclasses to obtain the configuration from other configuration source than /// the web.xml file. /// </remarks> /// <param name="configPrefix">configuration prefix to use for extracting configuration properties. /// </param> /// <param name="filterConfig">filter configuration object</param> /// <returns> /// the configuration to be used with the /// <see cref="AuthenticationHandler"/> /// instance. /// </returns> /// <exception cref="Javax.Servlet.ServletException">thrown if the configuration could not be created. /// </exception> protected internal virtual Properties GetConfiguration(string configPrefix, FilterConfig filterConfig) { Properties props = new Properties(); Enumeration <object> names = filterConfig.GetInitParameterNames(); while (names.MoveNext()) { string name = (string)names.Current; if (name.StartsWith(configPrefix)) { string value = filterConfig.GetInitParameter(name); props[Runtime.Substring(name, configPrefix.Length)] = value; } } return(props); }
/// <summary>Returns the proxyuser configuration.</summary> /// <remarks> /// Returns the proxyuser configuration. All returned properties must start /// with <code>proxyuser.</code>' /// <p/> /// Subclasses may override this method if the proxyuser configuration is /// read from other place than the filter init parameters. /// </remarks> /// <param name="filterConfig">filter configuration object</param> /// <returns>the proxyuser configuration properties.</returns> /// <exception cref="Javax.Servlet.ServletException">thrown if the configuration could not be created. /// </exception> protected internal virtual Configuration GetProxyuserConfiguration(FilterConfig filterConfig ) { // this filter class gets the configuration from the filter configs, we are // creating an empty configuration and injecting the proxyuser settings in // it. In the initialization of the filter, the returned configuration is // passed to the ProxyUsers which only looks for 'proxyusers.' properties. Configuration conf = new Configuration(false); Enumeration <object> names = filterConfig.GetInitParameterNames(); while (names.MoveNext()) { string name = (string)names.Current; if (name.StartsWith(ProxyuserPrefix + ".")) { string value = filterConfig.GetInitParameter(name); conf.Set(name, value); } } return(conf); }