Databases Reference
In-Depth Information
6.
Now when you run your
index.jspx
page, you will be redirected to the
login.
html
page. Provide the correct password to enter into the applicaion, otherwise
you will be redirected to the
error.html
page.
7.
With
HTTP based
Authenicaion
selected, the login prompt cannot be asked for
unless you restart the server. In
Form based Authenicaion
, the user is redirected
to the login page if the user's session expires.
What just happened?
Now we have the login page ready for our applicaion. Whenever the page is accessed by
the user, he/she will be redirected to the login page before entering the web applicaion.
The
web.xml
entry will change from
BASIC
to
FORM
as shown in the following code:
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.html</form-error-page>
</form-login-config>
</login-config>
And for the user that gets added, the changes will be in the
jazn-data.xml
file as follows:
<users>
<user>
<name>webuser</name>
<display-name>webuser</display-name>
<credentials>{903}hUdKmD5fW+iPvOj6ssYILvxD/eZNB5Tf
</credentials>
</user>
</users>
The
login.html
file will have the following entry to get the username and password from
the user. The name of the text field is important as the value is processed based on the name
of the text field. For example, in the following code, the username is retrieved by the text
field that has
j_username
as the username:
<input type="text" name="j_username"/>
Search WWH ::
Custom Search