views:

19

answers:

0

Hi, I was wondering if it was possible to have a Java EE application with multiple JAAS security realms. I'm currently developing an application in which some users need to be authenticated with data stored in a database, while other users need to be authenticated through an LDAP bind.

So I created 2 security realms in glassfish 3.1, a JDBC realm and an LDAP realm and configured my web.xml to use the LDAP realm (most users are LDAP).

I then use :

  HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
  request.login(username, password);

to authenticate user

is it possible to switch to JDBC realm before calling 'request.login' ?

thanks in advance