/** * Binds the security manager. Override this method in order to provide your own security manager binding. * <p/> * By default, a {@link org.apache.shiro.mgt.DefaultSecurityManager} is bound as an eager singleton. * * @param bind */ protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(DefaultSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in " + ShiroModule.class.getSimpleName(), e); } }
/** * Binds the security manager. Override this method in order to provide your own security manager binding. * <p/> * By default, a {@link org.apache.shiro.web.mgt.DefaultWebSecurityManager} is bound as an eager singleton. * * @param bind */ protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) { try { bind.toConstructor(DefaultWebSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in ShiroModule.", e); } }
@Override public <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor, TypeLiteral<? extends S> type) { return base.toConstructor(constructor, type); }
@Override public <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> constructor) { return base.toConstructor(constructor); }
@Override protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) { try { bind.toConstructor(ConcordWebSecurityManager.class.getConstructor(Collection.class, RememberMeManager.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in ShiroModule.", e); } } };
@Override protected void bindSessionManager( AnnotatedBindingBuilder<SessionManager> bind ) { bind.toConstructor( ctor( DefaultSessionManager.class ) ).asEagerSingleton(); }
@Override protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(KrailSecurityManager.class.getConstructor(Collection.class, Optional.class)) .asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, " + "" + "or there's a bug in ShiroModule.", e); } }
@Override protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(KrailSecurityManager.class.getConstructor(Collection.class, Optional.class)) .asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, " + "" + "or there's a bug in ShiroModule.", e); } }
/** * Binds the security manager. Override this method in order to provide your own security manager binding. * <p/> * By default, a {@link org.apache.shiro.mgt.DefaultSecurityManager} is bound as an eager singleton. * * @param bind */ protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(DefaultSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in " + ShiroModule.class.getSimpleName(), e); } }
/** * Binds the security manager. Override this method in order to provide your own security manager binding. * <p/> * By default, a {@link org.apache.shiro.web.mgt.DefaultWebSecurityManager} is bound as an eager singleton. * * @param bind */ protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) { try { bind.toConstructor(DefaultWebSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in ShiroModule.", e); } }
@SuppressWarnings("unchecked") @Override protected void configure() { for (int i = 0; i < types.length; i++) { bind((TypeLiteral<Object>) types[i]).toInstance((Object) args[i]); } Class<?>[] paramTypes = new Class<?>[types.length]; for (int i = 0; i < types.length; i++) { paramTypes[i] = types[i].getRawType(); } try { bind(klass).toConstructor(klass.getDeclaredConstructor(paramTypes)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(short.class).toInstance(s); try { bind(klass) .toConstructor(klass.getDeclaredConstructor(short.class)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(boolean.class).toInstance(b); try { bind(klass).toConstructor( klass.getDeclaredConstructor(boolean.class)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(char.class).toInstance(c); try { bind(klass).toConstructor(klass.getDeclaredConstructor(char.class)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(byte.class).toInstance(b); try { bind(klass).toConstructor(klass.getDeclaredConstructor(byte.class)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(long.class).toInstance(l); try { bind(klass).toConstructor(klass.getDeclaredConstructor(long.class)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(float.class).toInstance(f); try { bind(klass) .toConstructor(klass.getDeclaredConstructor(float.class)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(int.class).toInstance(i); try { bind(klass).toConstructor(klass.getDeclaredConstructor(int.class)); } catch (NoSuchMethodException e) {} }
@Override protected void configure() { bind(double.class).toInstance(d); try { bind(klass).toConstructor( klass.getDeclaredConstructor(double.class)); } catch (NoSuchMethodException e) {} }
@Override protected void bindSecurityManager( AnnotatedBindingBuilder<? super SecurityManager> bind ) { // prefer the default constructor; we'll set the realms programatically bind( DefaultSecurityManager.class ).toConstructor( ctor( DefaultSecurityManager.class ) ).asEagerSingleton(); // bind RealmSecurityManager and SecurityManager to _same_ component bind( RealmSecurityManager.class ).to( DefaultSecurityManager.class ); bind.to( DefaultSecurityManager.class ); // bindings used by external modules expose( RealmSecurityManager.class ); }