2

After get current user info I store it in session for later use, but most of the situation I need to get current user info not in a servlet context. Such as in non-servlet environment I need to call something like this:

UserUtils.getCurrentUser();

Any ideas on this?

Further question, I use Guice-servlet, maybe there is a way to inject current user?

Mike
  • 3,515
  • 10
  • 44
  • 67

2 Answers2

0

If i where you i would realy consider to use spring security! It provides everything you need for security!

Jimmy Geers
  • 670
  • 1
  • 13
  • 31
0

What security framework you are using? Try Shiro it can integrate with Guice quite easily Shiro Guice and you can use to annotation to handle Permission like this and other cool stuff.

 @Requires("supervisor")
 public void securedResource() {
 ...
 } 
Milan Baran
  • 4,133
  • 2
  • 32
  • 49