Search in sources :

Example 1 with RbacConfig

use of org.killbill.billing.util.config.definition.RbacConfig in project killbill by killbill.

the class KillBillShiroWebModule method configureShiroForRBAC.

private void configureShiroForRBAC() {
    final RbacConfig config = new ConfigurationObjectFactory(configSource).build(RbacConfig.class);
    bind(RbacConfig.class).toInstance(config);
    // Note: order matters (the first successful match will win, see below)
    bindRealm().toProvider(IniRealmProvider.class).asEagerSingleton();
    bindRealm().to(KillBillJdbcRealm.class).asEagerSingleton();
    if (KillBillShiroModule.isLDAPEnabled()) {
        bindRealm().to(KillBillJndiLdapRealm.class).asEagerSingleton();
    }
    bindListener(new AbstractMatcher<TypeLiteral<?>>() {

        @Override
        public boolean matches(final TypeLiteral<?> o) {
            return Matchers.subclassesOf(WebSecurityManager.class).matches(o.getRawType());
        }
    }, new DefaultWebSecurityManagerTypeListener(getProvider(ShiroEhCacheInstrumentor.class)));
    if (KillBillShiroModule.isRBACEnabled()) {
        addFilterChain(JaxrsResource.PREFIX + "/**", Key.get(CorsBasicHttpAuthenticationFilter.class));
    }
}
Also used : TypeLiteral(com.google.inject.TypeLiteral) IniRealmProvider(org.killbill.billing.util.glue.IniRealmProvider) KillBillJdbcRealm(org.killbill.billing.util.security.shiro.realm.KillBillJdbcRealm) KillBillJndiLdapRealm(org.killbill.billing.util.security.shiro.realm.KillBillJndiLdapRealm) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) RbacConfig(org.killbill.billing.util.config.definition.RbacConfig)

Example 2 with RbacConfig

use of org.killbill.billing.util.config.definition.RbacConfig in project killbill by killbill.

the class KillBillShiroModule method configureShiro.

protected void configureShiro() {
    final RbacConfig config = new ConfigurationObjectFactory(new ConfigSource() {

        @Override
        public String getString(final String propertyName) {
            return configSource.getString(propertyName);
        }
    }).build(RbacConfig.class);
    bind(RbacConfig.class).toInstance(config);
    bindRealm().toProvider(IniRealmProvider.class).asEagerSingleton();
    configureJDBCRealm();
    configureLDAPRealm();
}
Also used : KillbillConfigSource(org.killbill.billing.platform.api.KillbillConfigSource) ConfigSource(org.skife.config.ConfigSource) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) RbacConfig(org.killbill.billing.util.config.definition.RbacConfig)

Aggregations

RbacConfig (org.killbill.billing.util.config.definition.RbacConfig)2 ConfigurationObjectFactory (org.skife.config.ConfigurationObjectFactory)2 TypeLiteral (com.google.inject.TypeLiteral)1 KillbillConfigSource (org.killbill.billing.platform.api.KillbillConfigSource)1 IniRealmProvider (org.killbill.billing.util.glue.IniRealmProvider)1 KillBillJdbcRealm (org.killbill.billing.util.security.shiro.realm.KillBillJdbcRealm)1 KillBillJndiLdapRealm (org.killbill.billing.util.security.shiro.realm.KillBillJndiLdapRealm)1 ConfigSource (org.skife.config.ConfigSource)1