users@glassfish.java.net

Re: Getting Principal User an instantiated class

From: Martin Matula <martin.matula_at_oracle.com>
Date: Wed, 13 Oct 2010 16:48:45 +0200

Hi,

On Oct 7, 2010, at 1:05 AM, glassfish_at_javadesktop.org wrote:

> I have created a web service with Jersey running on glassfish v2. I
> am trying to get the Principal User that was authenticated with my
> Custom Login Module. The call comes in to the root resource with
> context and information and instantiates another class that performs
> all the work and delivers data back to the root resource.
>
> So in the instantiated class, i am having trouble getting the
> context of the request with the Principal User name.

You need to pass the context to the instantiated class from the root
resource. Can you do it? You can inject SecurityContext to the root
resource and pass it to the instantiated class in the constructor or a
method parameter.
Regards,
Martin