use of org.killbill.billing.util.security.shiro.realm.KillBillJdbcRealm in project killbill by killbill.
the class DefaultSecurityApi method invalidateJDBCAuthorizationCache.
private void invalidateJDBCAuthorizationCache(final String username) {
final Collection<Realm> realms = ((DefaultSecurityManager) SecurityUtils.getSecurityManager()).getRealms();
final KillBillJdbcRealm killBillJdbcRealm = (KillBillJdbcRealm) Iterables.tryFind(realms, new Predicate<Realm>() {
@Override
public boolean apply(@Nullable final Realm input) {
return (input instanceof KillBillJdbcRealm);
}
}).orNull();
if (killBillJdbcRealm != null) {
final SimplePrincipalCollection principals = new SimplePrincipalCollection();
principals.add(username, killBillJdbcRealm.getName());
killBillJdbcRealm.clearCachedAuthorizationInfo(principals);
}
}
use of org.killbill.billing.util.security.shiro.realm.KillBillJdbcRealm in project killbill by killbill.
the class TestUtilModuleWithEmbeddedDB method provideRealms.
@Provides
@Singleton
protected Set<Realm> provideRealms(final EmbeddedDB embeddedDB, final SecurityConfig securityConfig) throws IOException {
final Ini ini = new Ini();
ini.load("[users]\n" + "tester = tester, creditor\n" + "[roles]\n" + "creditor = invoice:credit, customx:customy\n");
final Realm iniRealm = new IniRealm(ini);
final Realm killBillJdbcRealm = new KillBillJdbcRealm(embeddedDB.getDataSource(), securityConfig);
return ImmutableSet.<Realm>of(iniRealm, killBillJdbcRealm);
}
Aggregations