2 Replies Latest reply on Mar 17, 2005 10:39 AM by tcherel

    JAAS Subject and J2EE principal

    tcherel

      This is probably more a pure J2EE related question than a JBoss specific one, but I did not find a lot of literature on this subject.

      JAAS defines an extensible authentication mechanism, where, at the end, you end up with a Subject containing all the principals created through the authentication process.

      J2EE provides access to the current principal (via the EJB or servlet context).

      JAAS is supposed to be THE authentication mechanism for J2EE (according to J2EE 1.3 and 1.4 spec).

      So why am I not finding a way to access the authenticated JAAS Subject from my EJB's? I think this is a big hole that is breaking the JAAS extensibility mechanism.
      There is no point to create your own JAAS login module that will add application specific principals to the subject if you cannot access these principals in your application (EJB's) later on, is there?
      I agree, you can still make it work by creating a custom principal that will be the one the app server will return through the EJB context. But it seems more like a hack to me than a nice and smooth JAAS/J2EE integration.

      Am I just missing something or is there a good reason for not being able to access the JAAS Subject?

      Any lights on this topic will help. Thanks.

      Thomas

        • 1. Re: JAAS Subject and J2EE principal
          starksm64

          Because J2EE has not actually defined how JAAS should be used. In general security is under-defined in J2EE. There is a jcp that is being considered for inclusion into j2ee 1.5 that is supposed to define how a container delegates authentication to a provider:

          http://www.jcp.org/en/jsr/detail?id=196

          Hopefully that will define how a Subject should be made available, provided that it makes it into j2ee 1.5.

          • 2. Re: JAAS Subject and J2EE principal
            tcherel


            Thanks a lot for the answer Scott.

            I am glad to see that my understanding was not totally wrong.
            I did notice this JSR but as the spec is not available for download and the activity seems to be fairly low, I could not verified that this will be my answer.

            I guess I will just have to wait and create custom principal for now...

            Thomas