|
The Login page is the first page that is shown when the Web NMS Web Client starts up. Validation of the login attempt and the
session is called 'Authentication'. Checking if the logged in user is allowed to perform a selected action is called 'Authorization'.This topic deals with customizing the Login.jsp page and details on authentication and authorization.
The Login page (or the start up page) is rendered by the Login.jsp file located in <Web NMS Home>/webclient/common/jsp directory. Preliminary, client-side validation of 'User Name' and 'Password' fields is done by this file. On choosing the 'WebStart' client the Login.jsp file verifies if Java WebStart is installed on the client machine, and accordingly forwards the request to WebStart.do (in turn WebStart.jsp of <Web NMS Home>/jsp directory is invoked). Similarly, on choosing 'Applet' client, the request is forwarded and the index.jsp file (of <Web NMS Home>/jsp directory) is invoked.
Logging in fails on providing incorrect username or password in the
login page, during authentication. The login action is handled by the
LoginAction
class
while the PasswordAction
, class handles the action
related to authentication. Once the user logs out the settings configured
by the user in the client interface is saved. All the actions performed
during logging out is handled by the LogoutAction
class.
Password Expiration
When the user password expires an appropriate message is displayed or
the passwordExpiry.jsp is invoked. This passwordExpiry.jsp file displays
the form through which the password and its expiration time can be configured.
The configuration of the user password and its expiration time is handled
by the UserConfigAPI.changePassword()
and UserConfigAPI.setUserStatus()
methods of the UserConfigAPI
class.
|
|
Note: All the JSP files related to login are found in <Web NMS Home>/webclient/common/jsp directory. |
The startup page or the login page of Web NMS clients is designed and laid by the Login.jsp file located in <Web NMS Home>/webclient/common/jsp directory.
Some of the customizations that can be performed in the login page are,
Displayed Images: It is possible to customize the images displayed in the login page. All the images are located in <Web NMS Home>/webclient/common/images directory. The header and logo images displayed at the top and bottom of the login page, respectively are located in <Web NMS Home>/webclient/common/images/advent directory. After replacing the images with the desired ones, modify the image entries in the Login.jsp file.
Displayed Text: All the displayed text such as Applet, Web Start, Web Client, etc., can be internationalized by identifying the keys in the EnglishToNative.properties file (located in <Web NMS Home>/html directory) and specifying your own values. Refer to the topic Internatinalizing the Web Client for more details.
Display Components: If you want to replace the display components such as textfields, radio buttons etc., of the login page. The login action must be handled by your class, which extends the LoginAction class. Given below is the code snippet for the radio button to choose the Applet client.
|
<input type="radio" name="clienttype" value="applet"> |
Backward Compatibility of Login.jsp file
If you have customized the Login.jsp file available under <Web NMS Home>/jsp directory in versions prior to Web NMS 4.5.0 and want to retain the customizations for the login page in the Web Client (of Web NMS 4.5.0) too, then do the following,
Copy your customized Login.jsp file into the <Web NMS Home>/jsp directory.
Edit the default value (i.e. webclient/common/html/Login.html) of the "DirectoryIndex" in the httpd.conf file located in <Web NMS Home>/apache/conf/backup directory with the following value,
|
DirectoryIndex jsp/Login.jsp |
Create a "template" directory under <Web NMS Home> directory.
Copy the following files available under the prior version <Web NMS Home>/template directory, and place under the created "template" directory as per the previous step. These files are required by the "previous" Login.jsp file.
nmshtmlui.css
validation.js
Place all the related images to be displayed in the login page under <Web NMS Home>/images directory.
Comment the "Authentication Filter" entries from the web.xml file of <Web NMS Home>/WEB-INF directory. The filter performs the authentication task when requested by the servlets or the JSP pages. You must ensure to handle the authentication check when navigating from Applet Client to Web Client.
|
<!--filter> <filter-name>AuthenticationFilter</filter-name> <filter-class>com.adventnet.nms.webclient.login.AuthenticationFilter</filter-class> <init-param> <param-name>excludeAuthentication</param-name> <param-value>Login.jsp,LoginPage.do,WebStart,jnlp</param-value> </init-param> </filter--> <!--filter-mapping> <filter-name>AuthenticationFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <filter-mapping> <filter-name>AuthenticationFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping--> |
Dynamically compile the JSP files. For more details on dynamic compilation click HERE.
Authentication of user input is handled by the AuthenticationFilter
class. The following entry in web.xml
ensures that all pages sent as requests or received as responses, pass
through the AuthenticationFilter.
Hence, every operation performed by the current user is authenticated.
|
<filter> <filter-name>AuthenticationFilter</filter-name> <filter-class>com.adventnet.nms.webclient.login.AuthenticationFilter</filter-class> </filter> <filter-mapping> <filter-name>AuthenticationFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <filter-mapping> <filter-name>AuthenticationFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> |
AuthenticationFilter can be extended to handle servlet authentication also.
Authorization checks if the current user is allowed to perform a particular action. The method GenericUtility.isAuthorized(userName, operation) is used to check the access permissions for the specified user, for the specified operation.
Session Timeout
A session timeout defines the maximum time that an existing inactive session is kept alive, before it is terminated by the Web NMS Server. By default, the Web client holds a session for 35 minutes unless explicit Logout has occurred. This value is specified in web.xml as shown below.
|
<session-config> <session-timeout>35</session-timeout> </session-config> |
Edit this value if you need to change the session timeout period.
|