users@glassfish.java.net

Re: Scope of custom LoginModule

From: Kumar Jayanti <v.b.kumar.jayanti_at_oracle.com>
Date: Tue, 27 Mar 2012 16:03:48 +0530

On 27-Mar-2012, at 3:40 PM, forums_at_java.net wrote:

> Hi, all.
>
> I have a problem with my custom MyLoginModule class (wich extends
> AppservPasswordLoginModule). In this class method authenticateUser() is
> called every time when the server processes GET method from client (and every
> time I have new instance of MyLoginModule). I thunk it's happen because
> AppservPasswordLoginModule has a PerLookup Scope. But in my implementation I
> need only one instane of MyLoginModule per session. And I woold like method
> authenticateUser() (login method in superclass) called once. Otherwise
> MyLoginModule won't work properly.

This happens because the code basically does :
LoginContext lg = new LoginContext(jaasCtx, s, callback);
lg.login();


>
> Is it possible?
>
> How can I do that?

You can do that if you use the Login Bridge Profile, though its a little bit more work, but you can control the number of times your LoginModule is instantiated.
https://blogs.oracle.com/nasradu8/entry/loginmodule_bridge_profile_jaspic_in


>
>
> --
>
> [Message sent by forum member 'prophe05']
>
> View Post: http://forums.java.net/node/884557
>
>