Re: How can I retrieve the authenticated user from within an MBean

"AGYNAMIX Torsten Uhlmann" <[email protected]>
Newsgroups gmane.comp.java.mx4j.user
Organization AGYNAMIX
Message-ID <001201c69ff2$8f61ef60$fa00a8c0@JOSHUA>
Thank you very much, works great!

Torsten.



-- 
 
Torsten Uhlmann
AGYNAMIX(R). Sheltering Talent.
 
Phone:   +49 3721 273445
Fax:     +49 3721 273446
Mobile:  +49 177 5261680
Web:     http://www.agynamix.de
  

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] 
> Sent: Tuesday, July 04, 2006 8:40 PM
> To: [email protected]
> Cc: [email protected]
> Subject: Re: [Mx4j-user] How can I retrieve the authenticated 
> user from within an MBean
> 
> Hi Torsten,
> 
> You could try this:
> 
> AccessControlContext acc = AccessController.getContext(); 
> Subject subject = Subject.getSubject(acc); Set principals = 
> subject.getPrincipals(); for (Iterator i = 
> principals.iterator(); i.hasNext(); ) {
>      Principal p = (Principal) i.next();
>      System.out.println("PRINCIPAL CLASS = " + 
> p.getClass().getName());
>      System.out.println("PRINCIPAL NAME  = " + p.getName()); }
> 
> Regards,
> Luis
> 
>  > AGYNAMIX Torsten Uhlmann wrote:
>  >
>  > Hi,
>  >
>  > I'm using an authenticated JMX connection (MX4J with  > 
> PasswordAuthenticator) over RMI using the JMXAuthenticator to 
>  > authenticate a user.
>  >
>  > Now when an MBean is invoked by the Client I'd like to 
> retrieve the  > Subject instance created during 
> authentication (I need the user's name)  > within this MBean 
> to log which user is performing which operation.
>  >
>  > Can you please point out the several steps to do this?
>  >
>  > Thanks,
>  > Torsten.
>  >
>  >
>  > --
>  >
>  > Torsten Uhlmann
>  > AGYNAMIX(R). Sheltering Talent.
>  >
>  > Phone:   +49 3721 273445
>  > Fax:     +49 3721 273446
>  > Mobile:  +49 177 5261680
>  > Web:     http://www.agynamix.de <http://www.agynamix.de/>
>  >
>  >
>  >
>  >
>  >
>  > 
> --------------------------------------------------------------
> ----------
>  >
>  > Using Tomcat but need to do more? Need to support web 
> services, security?
>  > Get stuff done quickly with pre-integrated technology to 
> make your job easier  > Download IBM WebSphere Application 
> Server v.1.0.1 based on Apache Geronimo  > 
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
dat=121642
>  >
>  >
>  > 
> --------------------------------------------------------------
> ----------
>  >
>  > _______________________________________________
>  > Mx4j-user mailing list
>  > [email protected]
>  > https://lists.sourceforge.net/lists/listinfo/mx4j-user
> 


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.