authentication - Tomcat 8 Basic auth -



authentication - Tomcat 8 Basic auth -

i trying implement basic auth in apache tomcat, encounter unusual problem.

when access http://localhost:8080. box show allow come in username , password, problem seens can not auth success, box show 1 time again , again.

below setting:

/web-inf/web.xml

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="webapp_id" version="3.1"> <display-name>test</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <security-constraint> <web-resource-collection> <web-resource-name></web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>manager</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>basic</auth-method> <realm-name>my realm</realm-name> </login-config> </web-app>

apache-tomcat-8.0.14/conf/tomcat-users.xml

<?xml version='1.0' encoding='utf-8'?> <!-- licensed apache software foundation (asf) under 1 or more contributor license agreements. see notice file distributed work additional info regarding copyright ownership. asf licenses file under apache license, version 2.0 (the "license"); may not utilize file except in compliance license. may obtain re-create of license @ http://www.apache.org/licenses/license-2.0 unless required applicable law or agreed in writing, software distributed under license distributed on "as is" basis, without warranties or conditions of kind, either express or implied. see license specific language governing permissions , limitations under license. --> <tomcat-users> <!-- note: default, no user included in "manager-gui" role required operate "/manager/html" web application. if wish utilize app, must define such user - username , password arbitrary. --> <!-- note: sample user , role entries below wrapped in comment , ignored when reading file. not forget remove <!.. ..> surrounds them. --> <!-- <role rolename="tomcat"/> <role rolename="role1"/> --> <role rolename="manager" /> <!-- <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> --> <user username="manager" password="manager" roles="manager"/> </tomcat-users>

this project structure

webcontent/index.jsp

just welcome file.

what did wrong? or did miss? have searched much still can not find solution. new stackoverflow, hope question clear, , body can help!

authentication tomcat8

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -