0 Replies Latest reply on Jul 19, 2006 8:01 AM by lost traveller

    How do you implement dynamic j2ee roles

    lost traveller Newbie

      I have a requirement that the j2ee roles for any given user may change dynamically in any given user session.
      I am using container managed security, buy how do I capture JBosses role checking code to call into my following code?:


      At the moment JBoss asks for a list of roles for a user when you log on, i.e.

       public Group[] getRoleSets()
       SimpleGroup callerPrincipal = new SimpleGroup("CallerPrincipal");
       SimpleGroup s = new SimpleGroup("Roles");
       s.addMember(new SimplePrincipal("a.j2ee.role"));
       s.addMember(new SimplePrincipal("b.j2ee.role"));
       return new Group[] { s, callerPrincipal};

      But I want to be able to calculate if a user has a given role at runtime using my own isUserInRole(Principal) method?

      Thanks in advance.