Note that there are some explanatory texts on larger screens.

plurals
  1. POUser Access Level in Java Web Application
    primarykey
    data
    text
    <p>I am trying to put user access level in My Java Web Application.But even I enter the correct username and password which I have declare in the tomcat-user.xml file It is not working. It gong to loginerror page. Basic Authentication Method also Not Accepting Correct Username and password. </p> <p>This tomcat-users.xml</p> <pre><code>&lt;tomcat-users&gt; &lt;!-- NOTE: By default, no user is included in the "manager-gui" role required to operate the "/manager/html" web application. If you wish to use this app, you must define such a user - the username and password are arbitrary. --&gt; &lt;!-- NOTE: The sample user and role entries below are wrapped in a comment and thus are ignored when reading this file. Do not forget to remove &lt;!.. ..&gt; that surrounds them. --&gt; &lt;!-- &lt;role rolename="tomcat"/&gt; &lt;role rolename="role1"/&gt; &lt;user username="tomcat" password="tomcat" roles="tomcat"/&gt; &lt;user username="both" password="tomcat" roles="tomcat,role1"/&gt; &lt;user username="role1" password="tomcat" roles="role1"/&gt; --&gt; &lt;role rolename=”Admin”/&gt; &lt;role rolename=”Member”/&gt; &lt;role rolename=”Doctor”/&gt; &lt;role rolename=”Guest”/&gt; &lt;user username=”sirojan” password=”sirojan” roles=”Admin” /&gt; &lt;user username=”ram” password=”ram123” roles=”Member” /&gt; &lt;user username=”vithu” password=”newbie” roles=”Guest” /&gt; &lt;/tomcat-users&gt; </code></pre> <p>This is a part of server.xml file</p> <pre><code>&lt;Realm className="org.apache.catalina.realm.LockOutRealm"&gt; &lt;Realm className="org.apache.catalina.realm.MemoryRealm" /&gt; &lt;!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --&gt; &lt;!-- &lt;Realm className="org.apache.catalina.realm.MemoryRealm" /&gt; --&gt; &lt;!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --&gt; &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/&gt;&lt;!-- --&gt; &lt;/Realm&gt; </code></pre> <p>This is My a part of web.xml file</p> <pre><code>&lt;security-role&gt; &lt;role-name&gt;Admin&lt;/role-name&gt; &lt;/security-role&gt; &lt;security-role&gt; &lt;role-name&gt;Member&lt;/role-name&gt; &lt;/security-role&gt; &lt;security-role&gt; &lt;role-name&gt;Guest&lt;/role-name&gt; &lt;/security-role&gt; &lt;security-role&gt; &lt;role-name&gt;Doctor&lt;/role-name&gt; &lt;/security-role&gt; &lt;login-config&gt; &lt;auth-method&gt;FORM&lt;/auth-method&gt; &lt;form-login-config&gt; &lt;form-login-page&gt;/login2.jsp&lt;/form-login-page&gt; &lt;form-error-page&gt;/loginerror.jsp&lt;/form-error-page&gt; &lt;/form-login-config&gt; &lt;/login-config&gt; &lt;security-constraint&gt; &lt;web-resource-collection&gt; &lt;web-resource-name&gt;AdminTasks&lt;/web-resource-name&gt; &lt;url-pattern&gt;/Department.jsp&lt;/url-pattern&gt; &lt;http-method&gt;GET&lt;/http-method&gt; &lt;http-method&gt;POST&lt;/http-method&gt; &lt;/web-resource-collection&gt; &lt;auth-constraint&gt; &lt;role-name&gt;Admin&lt;/role-name&gt; &lt;role-name&gt;Member&lt;/role-name&gt; &lt;/auth-constraint&gt; &lt;/security-constraint&gt; &lt;error-page&gt; &lt;error-code&gt;404&lt;/error-code&gt; &lt;location&gt;/notFoundError.jsp&lt;/location&gt; &lt;/error-page&gt; &lt;/web-app&gt; </code></pre> <p>Did I anything wrong??. If you need further pl comment it. Can you please give the solutions for that??</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload