San*_*aha 5 java authentication websphere websphere-liberty user-registry
WebSphere(传统):在基于容器的身份验证的情况下custom user registry,当从Web应用程序登录失败时,我们通过调用以下方法找到失败的根本原因:
com.ibm.websphere.security.auth.WSSubject.getRootLoginException();
以上API存在于:{Server_Root_Dir} /AppServer/plugins/com.ibm.ws.runtime_x.yzjar
反编译的方法源代码getRootLoginException()是:
public static Throwable getRootLoginException(){
return ContextManagerFactory.getInstance().getRootException();
}
Run Code Online (Sandbox Code Playgroud)
WebSphere(Liberty):如果使用基于容器的身份验证custom user registry,我们无法通过调用以下内容找到登录失败的根本原因:
com.ibm.websphere.security.auth.WSSubject.getRootLoginException();
以上API存在于:{Server_Root_Dir} /lib/com.ibm.websphere.security_x.yzjar
这是因为该方法的反编译源代码getRootLoginException()是:
public static Throwable getRootLoginException(){
return null;
}
Run Code Online (Sandbox Code Playgroud)
IBM声称:
public static java.lang.Throwable getRootLoginException()
这个方便的方法返回系统登录模块中捕获的根登录异常(如果存在).
它将从当前线程中提取异常.您将获得登录模块视为根异常的内容.这可能是嵌套异常.您可能需要从返回的异常中提取异常,直到获得真正的根异常.
返回:包含根登录异常的Throwable.如果未发生登录异常,则返回null.
我想知道在WebSphere(Liberty)中调用哪个API,以便找到登录失败的根本原因.
为什么需要WSSubject.getRootLoginException():
自定义实现com.ibm.websphere.security.UserRegistry要求您通过提供自己的定义来验证Web应用程序用户输入的用户名和密码checkPassword(String userSecurityName, String passwd).请参阅http://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/csec_customauth.html
如果用户提供的信息不正确,您可能会抛出PasswordCheckFailedException或CustomRegistryException发送消息.这checkPassword(String userSecurityName, String passwd)实际上是由WebSphere(传统或自由)从JAAS调用javax.security.auth.spi.LoginModule.login()和PasswordCheckFailedException或CustomRegistryException和他们的信息被包装和javax.security.auth.login.LoginException抛出.
为了向Web应用程序用户提供反馈,我们需要抓住从中抛出的异常javax.security.auth.spi.LoginModule.login().这样做的方法是com.ibm.websphere.security.auth.WSSubject.getRootLoginException()从servlet过滤器调用.这在WebSphere(传统)中工作正常,但在WebSphere(Liberty)中不再适用.问题是IBM没有在任何地方记录这个限制.
| 归档时间: |
|
| 查看次数: |
448 次 |
| 最近记录: |