[英]JAAS Error: Login failed
i'm building some restful webservices and try to secure them by using JAAS. 我正在构建一些宁静的Web服务,并尝试通过使用JAAS保护它们。
but i get the following error: 但我得到以下错误:
javax.servlet.ServletException: Login failed
I created a realm with the following attributes: 我创建了一个具有以下属性的领域:
JAAS-Context: jdbcDigestRealm
DIGEST-Algorithm: SHA-512
Encoding: Hex
password encryption: none
I try to log in by using HttpServletRequest: 我尝试使用HttpServletRequest登录:
request.login(email, password); //email = test@test.tld, password=<SHA512HEX('testPasswprd')>
Here is the StackTrace: 这是StackTrace:
WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: null
SEVERE: javax.servlet.ServletException: Login failed
at org.apache.catalina.authenticator.AuthenticatorBase.doLogin(AuthenticatorBase.java:959)
at org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:939)
at org.apache.catalina.connector.Request.login(Request.java:2245)
at org.apache.catalina.connector.Request.login(Request.java:2224)
at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1113)
Do you have some ideas? 你有什么主意吗?
EDIT: 编辑:
Sometimes I get a NullPointerException at 有时我在以下地方收到NullPointerException
request.login(email, password); //both variables and request are set.
WARNING: StandardWrapperValve[de.AuthTest.core.ApplicationConfig]: Servlet.service() for servlet de.AuthTest.core.ApplicationConfig threw exception
java.lang.NullPointerException
at org.apache.catalina.connector.Request.login(Request.java:2229)
at org.apache.catalina.connector.Request.login(Request.java:2224)
at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1113)
This tutorial was tested in Glassfish 4.0 with Java EE 7 application: 本教程已在带有Java EE 7应用程序的Glassfish 4.0中进行了测试:
Then set up Default Principal to Role Mapping on the GlassFish Server: 然后在GlassFish服务器上将默认主体设置为角色映射:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.