Search in sources :

Example 1 with TokenStorage

use of com.bakdata.conquery.models.auth.apitoken.TokenStorage in project conquery by bakdata.

the class ApiTokenRealmFactory method createRealm.

@Override
public ConqueryAuthenticationRealm createRealm(ManagerNode managerNode) {
    final TokenStorage tokenStorage = new TokenStorage(storeDir, apiTokenStoreConfig, managerNode.getValidator(), Jackson.BINARY_MAPPER.copy());
    managerNode.getEnvironment().lifecycle().manage(tokenStorage);
    final ApiTokenRealm apiTokenRealm = new ApiTokenRealm(managerNode.getStorage(), tokenStorage);
    managerNode.getAuthController().getAuthenticationFilter().registerTokenExtractor(new ApiTokenExtractor());
    JerseyEnvironment environment = managerNode.getEnvironment().jersey();
    environment.register(new AbstractBinder() {

        @Override
        protected void configure() {
            bind(apiTokenRealm).to(ApiTokenRealm.class);
        }
    });
    environment.register(ApiTokenResource.class);
    return apiTokenRealm;
}
Also used : JerseyEnvironment(io.dropwizard.jersey.setup.JerseyEnvironment) AbstractBinder(org.glassfish.hk2.utilities.binding.AbstractBinder) ApiTokenRealm(com.bakdata.conquery.models.auth.apitoken.ApiTokenRealm) TokenStorage(com.bakdata.conquery.models.auth.apitoken.TokenStorage)

Aggregations

ApiTokenRealm (com.bakdata.conquery.models.auth.apitoken.ApiTokenRealm)1 TokenStorage (com.bakdata.conquery.models.auth.apitoken.TokenStorage)1 JerseyEnvironment (io.dropwizard.jersey.setup.JerseyEnvironment)1 AbstractBinder (org.glassfish.hk2.utilities.binding.AbstractBinder)1