<div dir="ltr"><div><div><div><div><div>Hi devs,<br>how you doing?<br><br></div>I was checking out the security API proposed by Undertow and I&#39;ve identified that io.undertow.security.idm.IdentityManager receive an empty credential as parameter in two of its methods. After taking a look into the Java Docs and the exemple codes I figure out why.<br>
<br></div>As proposed in the original design, an IdentityManager should know which kind of credential was created by the AuthenticationMechanism, cast it, and then apply the desired identity match. It means that there&#39;s an existance relation between both IdentityManager and AuthenticationMechanism.<br>
<br>Maybe, making Credential a generic parameter of IdentityManager it will make IdentityManager more plugable. It also forces us the improve SecurityContext with this new design.<br><br></div>A little sample copied from BasicAuthenticationMechanism.java[106~110] as an exemple.<br>
<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:courier new,monospace">final IdentityManager&lt;</span><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">PasswordCredential&gt;</span></span> idm = securityContext.getIdentityManagerFor( </span><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">PasswordCredential.class </span>);</span><br>
<span style="font-family:courier new,monospace">final PasswordCredential credential = new PasswordCredential(password);</span><br><span style="font-family:courier new,monospace">try {</span><br><span style="font-family:courier new,monospace">    final AuthenticationMechanismOutcome result;</span><br>
<span style="font-family:courier new,monospace">    Account account = idm.verify(userName, credential);</span><br></blockquote><br></div>Let me know if this makes sense for Undertow needs!<br><br></div>Regards<br></div>