users@jersey.java.net

[Jersey] Injection in glassfish

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Tue, 26 Jun 2012 21:23:04 -0400

Hi,

I'm converting an old application to glassfish 3.1.2 which includes Jersey 1.12.

In my standalone application I injected a SecurityContext but it got
annoying, so eventually I injected a MyUserPrincipal by creating a
guice provider that generated that object by doing

   MyUserPrincipal mup = MyUserPrincipal = securityContext.getUserPrincipal();

Now I'm trying to convert the application over to work in glassfish,
and I'm kind of starting from scratch:

 * Users now come in as JAAS objects. I'm not really sure if Jersey
will see those as Principals or Subjects now. Maybe both?
 * I'm not quite sure if I should still try to subclass the JAAS idea
of a principal or not. The point here is I need to attach extra
information to the user to indicate things like which customer his
login is attached to, and which database instance he should point to.
I can't really manage those things by roles.


One thought I had was

   @Provider
   @ManagedBean
   public class VnomicsCustomerInfoProvider extends
PerRequestTypeInjectableProvider<Context, MyExtraUserInfo> { ... }

but how does HE get the SecurityContext in order to examine it and
inject this extra class of information?

--Chris