1 Reply Latest reply on Jul 30, 2005 12:12 PM by Scott Stark

    JAAS/LDAP - retrieve user roles from ldap using ldaploginmod

    Siva Uppari Newbie


      Ldaploginmodule of Jboss does the authentication and authorization. (Sample code provided below)

      Assume that ldaploginmodule configured in auth.conf , users & roles are configured in ldap.

      logincontext.login() --> This performs authentication with LDAP using ldaploginmodule, Also retrieves the roles assigned to that user and assign them to one of the ldaploginmodule attribute.

      These roles can be retrieved using gerRoleSets() method of ldaploginmodule.

      As the Client directly not interacting with ldaploginmodule instead this module has being called form logincontext class. Logincontext class does not provide methods to call gerRolesSet().

      How to retrieve these user roles? does this retrieval using logincontext or any other alternate approach?

      Sample Code:

      try {
      LoginContext loginContext = new LoginContext("ldapClient", new
      UsernamePasswordCallbackHandler("username", "password"));

      // How to retrieve the user roles from ldaploginmodule

      } catch (NamingException e) {
      } catch (RemoteException e) {
      } catch (CreateException e) {
      } catch (LoginException e) {