@Override protected void bindSecurityManager(final AnnotatedBindingBuilder<? super SecurityManager> bind) { super.bindSecurityManager(bind); final RedisCacheConfig redisCacheConfig = new ConfigurationObjectFactory(new ConfigSource() { @Override public String getString(final String propertyName) { return configSource.getString(propertyName); } }).build(RedisCacheConfig.class); // Magic provider to configure the cache manager if (redisCacheConfig.isRedisCachingEnabled()) { bind(CacheManager.class).toProvider(RedisShiroManagerProvider.class).asEagerSingleton(); } else { bind(CacheManager.class).toProvider(EhcacheShiroManagerProvider.class).asEagerSingleton(); } }
public void configure() { // setup security manager bindSecurityManager(bind(SecurityManager.class)); bindSessionManager(bind(SessionManager.class)); bindEnvironment(bind(Environment.class)); bindListener(BeanTypeListener.MATCHER, new BeanTypeListener()); bindEventBus(bind(EventBus.class)); bindListener(Matchers.any(), new SubscribedEventTypeListener()); bindListener(Matchers.any(), new EventBusAwareTypeListener()); final DestroyableInjectionListener.DestroyableRegistry registry = new DestroyableInjectionListener.DestroyableRegistry() { public void add(Destroyable destroyable) { ShiroModule.this.add(destroyable); } @PreDestroy public void destroy() { ShiroModule.this.destroy(); } }; bindListener(LifecycleTypeListener.MATCHER, new LifecycleTypeListener(registry)); expose(SecurityManager.class); expose(EventBus.class); configureShiro(); bind(realmCollectionKey()) .to(realmSetKey()); bind(DestroyableInjectionListener.DestroyableRegistry.class).toInstance(registry); BeanTypeListener.ensureBeanTypeMapExists(binder()); }
@Override protected void bindSecurityManager(final AnnotatedBindingBuilder<? super SecurityManager> bind) { super.bindSecurityManager(bind); // Magic provider to configure the cache manager bind(CacheManager.class).toProvider(EhCacheManagerProvider.class).asEagerSingleton(); }
@Override protected void bindSecurityManager(final AnnotatedBindingBuilder<? super SecurityManager> bind) { super.bindSecurityManager(bind); final RedisCacheConfig redisCacheConfig = new ConfigurationObjectFactory(new ConfigSource() { @Override public String getString(final String propertyName) { return configSource.getString(propertyName); } }).build(RedisCacheConfig.class); // Magic provider to configure the cache manager if (redisCacheConfig.isRedisCachingEnabled()) { bind(CacheManager.class).toProvider(RedisShiroManagerProvider.class).asEagerSingleton(); } else { bind(CacheManager.class).toProvider(EhcacheShiroManagerProvider.class).asEagerSingleton(); } }
public void configure() { // setup security manager bindSecurityManager(bind(SecurityManager.class)); bindSessionManager(bind(SessionManager.class)); bindEnvironment(bind(Environment.class)); bindListener(BeanTypeListener.MATCHER, new BeanTypeListener()); bindEventBus(bind(EventBus.class)); bindListener(Matchers.any(), new SubscribedEventTypeListener()); bindListener(Matchers.any(), new EventBusAwareTypeListener()); final DestroyableInjectionListener.DestroyableRegistry registry = new DestroyableInjectionListener.DestroyableRegistry() { public void add(Destroyable destroyable) { ShiroModule.this.add(destroyable); } @PreDestroy public void destroy() { ShiroModule.this.destroy(); } }; bindListener(LifecycleTypeListener.MATCHER, new LifecycleTypeListener(registry)); expose(SecurityManager.class); expose(EventBus.class); configureShiro(); bind(realmCollectionKey()) .to(realmSetKey()); bind(DestroyableInjectionListener.DestroyableRegistry.class).toInstance(registry); BeanTypeListener.ensureBeanTypeMapExists(binder()); }