Yes it is possible, but requires some glue code if you want Guice to create your Realms. Bind Realm implementation: bind(Realm. Class).
To(MyRealm. Class). In(Singleton.
Class); Bind WebSecurityManager: @Provides @Singleton WebSecurityManager securityManager(Realm realm) { DefaultWebSecurityManager sm = new DefaultWebSecurityManager(); sm. SetRealm(realm); return sm; } Subclass one of Shiro filters so you can use Guice provided WebSecurityManager: public class SecurityFilter extends IniShiroFilter { static class SecurityManagerFactory extends WebIniSecurityManagerFactory { private final WebSecurityManager securityManager; public SecurityManagerFactory(WebSecurityManager securityManager) { this. SecurityManager = securityManager; } public SecurityManagerFactory(WebSecurityManager securityManager, Ini ini) { super(ini); this.
SecurityManager = securityManager; } @Override protected SecurityManager createDefaultInstance() { return securityManager; } } private final Provider securityManager; @Inject SecurityFilter(Provider securityManager) { super(); this. SecurityManager = securityManager; } protected Map applySecurityManager(Ini ini) { SecurityManagerFactory factory; if (ini == null || ini.isEmpty()) { factory = new SecurityManagerFactory(securityManager.get()); } else { factory = new SecurityManagerFactory(securityManager.get(), ini); } setSecurityManager((WebSecurityManager) factory.getInstance()); return factory.getBeans(); } } Configure your filter: Joiner lines = Joiner. On("\n"); Map config = ImmutableMap.
Of("config", lines. Join( "; here you can provide additional ini", "roles", "admin = *", "urls", "/secure/** = authcBasic" )); filter("/*"). Through(SecurityFilter.
Class, config).
Thanx for answer with full code! So eventually config must be in ini format anyway? – newbie May 6 at 6:02 Ini is optional, you can configure WebSecuirtyManager in provider method manually.
– sanjarj May 6 at 7:00.
Yes it is possible, but requires some glue code if you want Guice to create your Realms.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.