How to access the Principal from a Java service object without using FlexContext?
Posted
by Marplesoft
on Stack Overflow
See other posts from Stack Overflow
or by Marplesoft
Published on 2010-05-28T00:05:36Z
Indexed on
2010/05/28
0:11 UTC
Read the original article
Hit count: 556
We're building some Java objects that are exposed via BlazeDS to our flex client application. So basically the BlazeDS messagebroker servlet instantiates and invokes methods on these objects in response to client requests. Works great.
We're using app server-based authentication and have set up a security constraint on the <destination>
elements in the remoting-config.xml file element to prevent unauthenticated clients from being able to access these remote java objects. Again, works fine.
However, there are several places within the implementation of these java objects where we want to get the currently logged on user's username. Right now we are doing this via FlexContext.getUserPrincipal()
, which gives access to this but we have a nagging concern that we don't like the idea that the implementation of these objects (the service layer) has a hard dependency on a BlazeDS class. But we're not sure how else to get access to this. The same applies to accessing the ServletContext and such.
Any ideas?
© Stack Overflow or respective owner