<div dir="ltr">Hi,<div><br></div><div>I remember that in older versions of JBoss there always was a (proprietary) API to explicitly clear the authentication cache. Maybe this could be of help here if that API is still there.</div><div><br></div><div>An other option would be to try using the Java EE standard API for custom authentication modules. This is called JASPIC and WildFly has excellent support for those. Support is best in the latest version of WildFly, which is 10cr5.</div><div><br></div><div>Kind regards,</div><div>Arjan Tijms</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 5, 2016 at 9:18 AM, Sony Abraham <span dir="ltr">&lt;<a href="mailto:sony.abraham@ibsplc.com" target="_blank">sony.abraham@ibsplc.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-IN" link="#0563C1" vlink="#954F72">
<div>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">Hi,<u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;min-height:8pt;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"> <u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">I am trying to port our existing application (in weblogic) to Jboss wildfly.<u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;min-height:8pt;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"> <u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">Our application supports multiple logins under same user id but each logins need to be treated in different security context. For this we invoke the login modules by invoking j_security_check for each
 logins attempts. We use a custome Jaas login module from where the subject is created with a unique user token and set as name of the Principal after successful login. But when using wildfly, the login module is invoked only the first time and for the subsequent
 login attempts, the user subject is looked up from the domain cache inside JBossCachedAuthenticationManager.<u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;min-height:8pt;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"> <u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">Further debugging into the issue i noticed below<u></u><u></u></span></p>
<p style="margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<u></u><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"><span>1.<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">After jaas login completes, the org.wildfly.extension.undertow.security.AccountImpl in exchange of ServletRequest gets updated with the new Principal (token set during jaas
 login) and the OriginalPrincipal remains the same as the user id. This is fine  as expected (I hope).<u></u><u></u></span></p>
<p style="margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<u></u><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"><span>2.<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">org.wildfly.extension.undertow.security.JAASIdentityManagerImpl.verifyCredential(final AccountImpl account, final Object credential) uses the OriginalPrincipal to send to
 authenticationManager for validation. Since this is not updated, it will always be the original user id. 
<span style="background:white">Below source code from <a href="http://jboss.as" target="_blank">jboss.as</a> uses<span> </span></span></span><span style="font-family:Consolas;color:#333333;border:none windowtext 1.0pt;padding:0cm;background:white">account</span><span><span style="font-family:Consolas;color:#a71d5d;border:none windowtext 1.0pt;padding:0cm;background:white">.</span></span><span style="font-family:Consolas;color:#333333;border:none windowtext 1.0pt;padding:0cm;background:white">getPrincipal()
 for getting the incomingPrincipal. But this is now changed to getOriginalPrincipal.<span> </span></span><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"> I think this should be the principal (not the OriginalPrincipal).<u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;text-indent:36.0pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<img width="715" height="182" src="cid:image001.png@01D147BF.BB5A7BD0"><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"><u></u><u></u></span></p>
<p style="margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<u></u><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"><span>3.<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">org.jboss.security.authentication.JBossCachedAuthenticationManager caches the subject info against the OriginalPrincipal. Therefor it always returns from the cache after
 the first successful authentication for a user id and JAAS login module is never invoked after that. Shouldn&#39;t the caching happen against the authenticated principal set in the subject (CallerPrincipal).<u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;min-height:8pt;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"> <u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">Can anyone please let me know whether this behavior change is possible ? Or is there any way I can configure custom class for org.wildfly.extension.undertow.security.JAASIdentityManagerImpl and org.jboss.security.authentication.JBossCachedAuthenticationManager
 in wildfly 9.0.2.<u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;min-height:8pt;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d"> <u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">Regards<u></u><u></u></span></p>
<p style="margin:0cm;margin-bottom:.0001pt;line-height:16.25pt;background:white;vertical-align:baseline;word-spacing:0px">
<span style="font-family:&quot;Cabin&quot;,&quot;serif&quot;;color:#3d3d3d">Sony<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<br>
<br>
DISCLAIMER: <font color="#999999" size="1" face="Tahoma">&quot;The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in
 error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not
 liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect.&quot;</font><br>
<font size="1"></font>
</div>

<br>_______________________________________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br></blockquote></div><br></div>