我正在尝试在java ee项目中实现基本身份验证,但我无法找到默认用户名和密码(如果有的话)。
我的web.xml如下所示:
<?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>
我的索引页面是一个登录表单,它应该在成功登录时启动会话..这种工作,它允许我看到下一页..现在,如果我不通过索引页面,我输入的网址第二页,一个登录窗口弹出,但无论我输入什么,它都不让我看到页面...我试过admin-adminadmin,admin-pass,admin-admin和其他人,但没有任何作品..
任何帮助都会非常感激!!!感谢!!!
答案 0 :(得分:-1)
我找到了如何从localhost配置:4848