On 2024/05/07 18:20:46 Mark Thomas wrote:
> On 07/05/2024 19:06, Michael Osipov wrote:
> > Folks,
> > 
> > I am working on a custom Authenticator and Realm where I need to pass 
> > down a custom value to Realm#authenticate(), more specially a value 
> > obtained from javax.security.auth.Subject#getPrivateCredentials(). 
> > Currently, there is no such facility in the interface. Any idea how to 
> > pass this down w/o touching the interface and w/o thread-local values? 
> > The only thing I can think of is a custom realm interface, but that 
> > means every realm needs to implement it...
> 
> Cast to your custom Realm in your custom Authenticator and then call any 
> method you like? It sounds like the Realm and Authenticator are coupled 
> together anyway.

Yes, but not quite. The authenticator does work with any realm Tomcat provides, 
but should also provide this custom realm of mine. So I will likely consider:

if (realm instanceof CustomRealm) {
doFoo()
} else{
doBar()
}

Thanks Mark!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to