Search in sources :

Example 1 with SerializingStore

use of com.bakdata.conquery.io.storage.xodus.stores.SerializingStore in project conquery by bakdata.

the class TokenStorage method start.

@Override
public void start() {
    String storeName = "api-token";
    File tokenStore = new File(storageDir.toFile(), storeName);
    environment = Environments.newInstance(tokenStore, storeConfig.createConfig());
    final XodusStore data = new XodusStore(environment, "DATA", this::closeStoreHook, this::removeStoreHook);
    dataStore = StoreMappings.cached(new SerializingStore<>(data, validator, objectMapper, ApiTokenHash.class, ApiTokenData.class, true, false, null));
    openStoresInEnv.add(data);
    final XodusStore meta = new XodusStore(environment, "META", this::closeStoreHook, this::removeStoreHook);
    metaDataStore = StoreMappings.cached(new SerializingStore<>(meta, validator, objectMapper, UUID.class, ApiTokenData.MetaData.class, true, false, null));
    openStoresInEnv.add(meta);
}
Also used : XodusStore(com.bakdata.conquery.io.storage.xodus.stores.XodusStore) SerializingStore(com.bakdata.conquery.io.storage.xodus.stores.SerializingStore) File(java.io.File)

Example 2 with SerializingStore

use of com.bakdata.conquery.io.storage.xodus.stores.SerializingStore in project conquery by bakdata.

the class LocalAuthenticationRealm method onInit.

@Override
protected void onInit() {
    super.onInit();
    // Open/create the database/store
    File passwordStoreFile = new File(storageDir, storeName);
    passwordEnvironment = Environments.newInstance(passwordStoreFile, passwordStoreConfig.createConfig());
    passwordStore = StoreMappings.cached(new SerializingStore<>(new XodusStore(passwordEnvironment, "passwords", store -> store.getEnvironment().close(), store -> {
    }), validator, mapper, UserId.class, PasswordHasher.HashedEntry.class, false, true, null));
}
Also used : EnvironmentClosedException(jetbrains.exodus.env.EnvironmentClosedException) CredentialType(com.bakdata.conquery.apiv1.auth.CredentialType) SneakyThrows(lombok.SneakyThrows) Environments(jetbrains.exodus.env.Environments) UserId(com.bakdata.conquery.models.identifiable.ids.specific.UserId) UserManageable(com.bakdata.conquery.models.auth.UserManageable) AuthenticationToken(org.apache.shiro.authc.AuthenticationToken) StoreMappings(com.bakdata.conquery.io.storage.StoreMappings) PasswordCredential(com.bakdata.conquery.apiv1.auth.PasswordCredential) Duration(io.dropwizard.util.Duration) Environment(jetbrains.exodus.env.Environment) ImmutableList(com.google.common.collect.ImmutableList) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) XodusStore(com.bakdata.conquery.io.storage.xodus.stores.XodusStore) SkippingCredentialsMatcher(com.bakdata.conquery.models.auth.util.SkippingCredentialsMatcher) ExodusException(jetbrains.exodus.ExodusException) Conquery(com.bakdata.conquery.Conquery) MoreCollectors(com.google.common.collect.MoreCollectors) Destroyable(org.apache.shiro.util.Destroyable) XodusConfig(com.bakdata.conquery.models.config.XodusConfig) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Validator(javax.validation.Validator) IOException(java.io.IOException) User(com.bakdata.conquery.models.auth.entities.User) ConqueryTokenRealm(com.bakdata.conquery.models.auth.conquerytoken.ConqueryTokenRealm) File(java.io.File) Store(com.bakdata.conquery.io.storage.Store) ConqueryAuthenticationRealm(com.bakdata.conquery.models.auth.ConqueryAuthenticationRealm) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) AuthenticationException(org.apache.shiro.authc.AuthenticationException) ConqueryAuthenticationInfo(com.bakdata.conquery.models.auth.ConqueryAuthenticationInfo) Optional(java.util.Optional) AuthenticatingRealm(org.apache.shiro.realm.AuthenticatingRealm) MetaStorage(com.bakdata.conquery.io.storage.MetaStorage) SerializingStore(com.bakdata.conquery.io.storage.xodus.stores.SerializingStore) HashedEntry(com.bakdata.conquery.models.auth.basic.PasswordHasher.HashedEntry) XodusStore(com.bakdata.conquery.io.storage.xodus.stores.XodusStore) SerializingStore(com.bakdata.conquery.io.storage.xodus.stores.SerializingStore) File(java.io.File)

Aggregations

SerializingStore (com.bakdata.conquery.io.storage.xodus.stores.SerializingStore)2 XodusStore (com.bakdata.conquery.io.storage.xodus.stores.XodusStore)2 File (java.io.File)2 Conquery (com.bakdata.conquery.Conquery)1 CredentialType (com.bakdata.conquery.apiv1.auth.CredentialType)1 PasswordCredential (com.bakdata.conquery.apiv1.auth.PasswordCredential)1 MetaStorage (com.bakdata.conquery.io.storage.MetaStorage)1 Store (com.bakdata.conquery.io.storage.Store)1 StoreMappings (com.bakdata.conquery.io.storage.StoreMappings)1 ConqueryAuthenticationInfo (com.bakdata.conquery.models.auth.ConqueryAuthenticationInfo)1 ConqueryAuthenticationRealm (com.bakdata.conquery.models.auth.ConqueryAuthenticationRealm)1 UserManageable (com.bakdata.conquery.models.auth.UserManageable)1 HashedEntry (com.bakdata.conquery.models.auth.basic.PasswordHasher.HashedEntry)1 ConqueryTokenRealm (com.bakdata.conquery.models.auth.conquerytoken.ConqueryTokenRealm)1 User (com.bakdata.conquery.models.auth.entities.User)1 SkippingCredentialsMatcher (com.bakdata.conquery.models.auth.util.SkippingCredentialsMatcher)1 XodusConfig (com.bakdata.conquery.models.config.XodusConfig)1 UserId (com.bakdata.conquery.models.identifiable.ids.specific.UserId)1 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1