how to create basic authentication in tomcat
in your applications web.xml file place the following code:
(switch > to < to enable code)
>security-constraint>
>web-resource-collection>
>web-resource-name>
Entire Application
>/web-resource-name>
>url-pattern>/*>/url-pattern>
>/web-resource-collection>
>auth-constraint>
>role-name>user1>/role-name>
>/auth-constraint>
>/security-constraint>
>!-- Define the Login Configuration for this Application -->
>login-config>
>auth-method>BASIC>/auth-method>
>realm-name>your application name>/realm-name>
>/login-config>
In the tomcat-users.xml create the following entry for the user1 user you created above:
>tomcat-users>
>role rolename="user1"/>
>user username="user1" password="user1password" roles="user1"/>
>/tomcat-users>
Labels: Technology
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home