I'm trying to implement basic authentication in a java ee project but I cant find what the default username and password is (if there is any).
My web.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-开发者_开发百科name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Constraint1</display-name>
<web-resource-collection>
<web-resource-name>view.xml</web-resource-name>
<description/>
<url-pattern>/faces/view.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Login</realm-name>
<form-login-config>
<form-login-page>/index.xhtml</form-login-page>
<form-error-page>/index.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description/>
<role-name>user</role-name>
</security-role>
</web-app>
My index page is a login form which should start the session upon successful login..this kinda work and it allows me to see the next page..Now if I dont go through the index page and I type in the url of that second page, a login window pops up but no matter what I type in there it doesnt let me see the page...I tried admin-adminadmin, admin-pass, admin-admin and others but nothing works..
Any help would be really appreciated!!! Thanks!!!
I found how to configure that from localhost:4848
精彩评论