A Guice-ready security framework?

2020-06-08 18:53发布

问题:

Has anybody seen a framework which is either written to work with Guice or a library that integrates an existing security system (ie: Acegi) with Guice?

I have found the following thus far...

http://code.google.com/p/warp-security/ (I think this abandonware)

http://code.google.com/p/warp-security/ (no documentation)

回答1:

Apache Shiro 1.2 and later has native support for Guice applications:

http://shiro.apache.org/guice.html

HTH!



回答2:

For whatever it's worth (being quite a late answer), I've had success integrating Apache Shiro with Guice. Last time I checked, Acegi was too deeply dependent on Spring to be usable in a pure Guice solution. Shiro's documentation is a little lacking, but the API is pretty straight-forward and easy to use, if don't mind a little digging.


In case it's of any interest, I've posted a Gist of the simplest example I could find. Two caveats:

  1. It's written against a pre-release version of Shiro 1.0
  2. The Active Directory realm we're using is a somewhat modified version from the main Shiro source, using some ideas from the Active Directory plugin for Jenkins (then Hudson).

Hopefully, it's enough to get you started...