GlasshFish 基本身份验证默认用户名和密码
我正在尝试在 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 等,但没有任何效果..
任何帮助将非常感激!谢谢!!!
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!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了如何从 localhost:4848 配置它
I found how to configure that from localhost:4848