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().这样做的方法是 …
java authentication websphere websphere-liberty user-registry
我有一条复杂的路线,如下所示(部分):
.when(header("KEY_1").isNull())
.choice()
.when(header("KEY_2").isNull())
.split().method(SplitExample.class, "invokeSplitter").streaming().parallelProcessing().executorService(threadPoolExecutor) // first split
.policy(requires_new)
.bean(SplitExample.class, "enrich")
.bean(persister,"populateRecordAndXRef")
.bean(initializer, "initialize")
.bean(validator, "validateInMsg")
.bean(suppressResolver, "resolve")
.choice()
.when(header("KEY_3").isNull())
.bean(MsgConverter.class,"doInvoke" ) // #1 property or header set here
.split(body()) // second split
.bean(validator, "validateOutMsg")
.to(toURI.toArray(new String[ toURI.size()]))
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println(exchange.getException()); // #2 queue server is shut down here so that transaction failure occurs
}
})
.endChoice() //end when
.end() //end choice
.end() //end policy
.end() //end split
.endChoice() //end …Run Code Online (Sandbox Code Playgroud)