Defining Security Constraints on Content under Glassfish Docroot


Perform the following 5 steps:
  • create a new web module
  • define the security-constraints, and associated login-config in the web.xml of the web.module
  • use the alternative docroot mapping facility of sun-web.xml, to map all url-patterns to docroot. If the configured login mechanism is Form Based Login, define additional alternative docroot mapping rules to ensure that requests for the login and error pages are mapped to the context root of the default web module. For example, assuming the context root of the web module is "/DefaultWebModule", you could add the following alternative docroot mapping rules to the module's sun-web.xml
    <sun-web-app/>
        <property name="alternatedocroot_1" 
                     value="from=/\* dir=docroot"/>
        <property name="alternatedocroot_2" 
                     value="from=/login.jsp dir=applications/j2ee-modules/DefaultWebModule"/>
        <property name="alternatedocroot_3" 
                     value="from=/error.jsp dir=applications/j2ee-modules/DefaultWebModule"/> 
    
    See [Jan Luehe's Web Blog] for a complete description of the Glassfish facility to define alternative docroots for web applications.
  • deploy the web module
  • use the Glassfish admin console to configure your web module as the default web module for the virtual server. For example, navigate to
    Configuration -> HTTP Service -> Virtual Servers -> server
    
    and select your delpoyed web module in the pull-down list labeled "Default Web Module:".

After you have performed the above steps, all requests to context root "/" at the virtual server, i.e., http://<hostname>:8080/ will be subject to the security constraints defined it the default web module, and will be mapped to the domains/domainX/docroot directory.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

monzillo

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today