Authorization filter ver. 1.1

This is a Java servlet filter (as per Servlet API 2.3). This filter lets you quickly deploy access restriction rules for your resources. Simply map this filter to resources you are going to protect and provide authorization rules right in filter's parameters.

How to use it:

a) download authflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml. You may provide the following initial parameters:
1) name - describes a valid name for the authorization dialogue
2) password - describes a password for the authorization dialogue
3) realm - Optional parameter. Describes a title (caption) for the authorization dialogue. Default value is Acceess filter.
4) error - Optional parameter. Describes an URI for the authorization error page redirection. If target URL starts with http than failed request will be redirected. Otherwise filter assumes a local resource and forwards request.

for example:
 


<filter>
  <filter-name>AuthFilter</filter-name>
  <filter-class>com.cj.auth.AuthFilter</filter-class>
  <init-param>
    <param-name>name</param-name>
    <param-value>guest</param-value>
  </init-param>
  <init-param>
    <param-name>password</param-name>
    <param-value>12345</param-value>
  </init-param>
</filter>

c) describe a mapping for this filter in web.xml. E.g.:
 


<filter-mapping>
  <filter-name>AuthFilter</filter-name>
  <url-pattern>/closed/*.jsp</url-pattern>
</filter-mapping>

in this example filter will be on for the each .jsp file in /closed sub-directory. So for the each request for .jsp file from that directory filter will check out authorization settings (user name: guest, password: 12345) and popup authorization dialogue if nessecory.
For JSP access see also Password protected taglib

   For downloading:

    Authorization filter:  authflt.jar
 

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: