Search in sources :

Example 1 with AuthenticationRealmFactory

use of com.bakdata.conquery.models.config.auth.AuthenticationRealmFactory in project conquery by bakdata.

the class AuthorizationController method externalInit.

public void externalInit(ManagerNode manager, List<AuthenticationRealmFactory> authenticationRealmFactories) {
    manager.getAdmin().getJerseyConfig().register(authenticationFilter);
    manager.getEnvironment().jersey().register(authenticationFilter);
    // Init authentication realms provided by the config.
    for (AuthenticationRealmFactory authenticationConf : authenticationRealmFactories) {
        ConqueryAuthenticationRealm realm = authenticationConf.createRealm(manager);
        authenticationRealms.add(realm);
        realms.add(realm);
    }
    // Register all realms in Shiro
    log.info("Registering the following realms to Shiro:\n\t{}", realms.stream().map(Realm::getName).collect(Collectors.joining("\n\t")));
    securityManager.setRealms(realms);
}
Also used : Realm(org.apache.shiro.realm.Realm) AuthorizingRealm(org.apache.shiro.realm.AuthorizingRealm) ConqueryTokenRealm(com.bakdata.conquery.models.auth.conquerytoken.ConqueryTokenRealm) ApiTokenRealm(com.bakdata.conquery.models.auth.apitoken.ApiTokenRealm) AuthenticationRealmFactory(com.bakdata.conquery.models.config.auth.AuthenticationRealmFactory)

Example 2 with AuthenticationRealmFactory

use of com.bakdata.conquery.models.config.auth.AuthenticationRealmFactory in project conquery by bakdata.

the class ApiTokenRealmTest method overrideConfig.

@Override
public ConqueryConfig overrideConfig(ConqueryConfig conf, final File workDir) {
    XodusStoreFactory storageConfig = (XodusStoreFactory) conf.getStorage();
    final Path storageDir = workDir.toPath().resolve(storageConfig.getDirectory().resolve(getClass().getSimpleName()));
    return conf.withStorage(storageConfig.withDirectory(storageDir)).withAuthenticationRealms(ImmutableList.<AuthenticationRealmFactory>builder().addAll(conf.getAuthenticationRealms()).add(new ApiTokenRealmFactory(storageDir, new XodusConfig())).build());
}
Also used : Path(java.nio.file.Path) XodusStoreFactory(com.bakdata.conquery.models.config.XodusStoreFactory) ApiTokenRealmFactory(com.bakdata.conquery.models.config.auth.ApiTokenRealmFactory) XodusConfig(com.bakdata.conquery.models.config.XodusConfig) AuthenticationRealmFactory(com.bakdata.conquery.models.config.auth.AuthenticationRealmFactory)

Aggregations

AuthenticationRealmFactory (com.bakdata.conquery.models.config.auth.AuthenticationRealmFactory)2 ApiTokenRealm (com.bakdata.conquery.models.auth.apitoken.ApiTokenRealm)1 ConqueryTokenRealm (com.bakdata.conquery.models.auth.conquerytoken.ConqueryTokenRealm)1 XodusConfig (com.bakdata.conquery.models.config.XodusConfig)1 XodusStoreFactory (com.bakdata.conquery.models.config.XodusStoreFactory)1 ApiTokenRealmFactory (com.bakdata.conquery.models.config.auth.ApiTokenRealmFactory)1 Path (java.nio.file.Path)1 AuthorizingRealm (org.apache.shiro.realm.AuthorizingRealm)1 Realm (org.apache.shiro.realm.Realm)1