0 Replies Latest reply on Sep 2, 2011 11:14 AM by kroessi

    How to fill roles in custom authenticator?

    kroessi

      Hi all,

       

      following the article http://community.jboss.org/wiki/WebAuthenticationUsingHTTPRequestParameters we are trying to implement a custom authenticator which receives username, roles and some other attributes as request attributes. We used GenericHeaderAuthenticator as a sample.

      We already managed to login the user, but we do not get the roles into the Subject (we do not know how to access the Subject either).

       

      Here a code snippet

       

      {code}
      public class SSOAuthenticator extends FormAuthenticator {
          @Override
          public boolean authenticate(Request request, Response response, LoginConfig config) throws java.io.IOException {

        SSOPrincipal principal = new SSOPrincipal();
              principal.setRole((String) request.getAttribute("Role"));
              principal.setUserName((String) request.getAttribute("Username"));
              request.setUserPrincipal(principal);
              register(request, response,
                      principal, Constants.FORM_METHOD,
                      principal.getUserName(), null);
        return principal.isCompletete();
      }
      }
        {code}

       

      Can anyone give us a hint how to do this?

       

      Thanks and best regards,

      Katja