1 Reply Latest reply on Mar 16, 2006 8:35 AM by darren hartford

    Can you a list of roles from a principal?

    Mark French Newbie


      I have a requirement to get a list of roles from an authenicated principal but can't seem to figure out how to do it. Is it possible to do it programmaticaly from a session bean?



        • 1. Re: Can you a list of roles from a principal?
          darren hartford Expert

          Hi markfrench,
          I have run into this problem as well and through JAAS have found no way of doing this when keeping to the API.

          You can either extend your own JAAS implementation to add additional API to list the roles a user has access to, or pull that information based on your implementation (i.e. if you use the DatabaseLoginModule or the LdapLogin Module, programatticaly access those sources directly).

          An alternative is if your application has a controlled list of roles that it allows, you can iterate through the controlled list and keep checking with 'InRole' or whatever that JAAS method is to populate a list of roles that way (which would not break the JAAS API).