1 Reply Latest reply on Jan 20, 2013 8:17 AM by Daniel Tavares

    Custom role in custom login module

    Daniel Tavares Newbie




      I`ve devepoed a custom login module that add a custom role in principal.


      The problem is that jboss ignore my role. Files>



      public class LeveJaasGroupPrincipal implements Group {
       nane ....



      public class LeveJaasLoginModule implements LoginModule {
        public boolean commit() throws LoginException {
             subject.getPublicCredentials().addAll(currentUser.getGroups()); // works fine. Add a LeveJaasGroupPrincipal with name LeveUser





      <description>Main Group</description>
      <web-resource-name>All resources</web-resource-name>
      <description>Protects all resources</description>



      After logi a got the error "HTTP Status 403 - Access to the requested resource has been denied"


      What should i do to jboss recognize my group type?

        • 1. Re: Custom role in custom login module
          Daniel Tavares Newbie

          ok, after a long debugging nigh, i found it:


          I  just need to add a main group called "Roles" (org.jboss.security.SecurityConstants.ROLES_IDENTIFIER in fact).




          LeveJaasGroupPrincipal mainGroup = new LeveJaasGroupPrincipal();


          for(Group g:  currentUser.getGroups()){





          I dont know if there is a better solution to do it, but it solve my problem