use of com.bakdata.conquery.models.auth.basic.LocalAuthenticationRealm in project conquery by bakdata.
the class LocalAuthRealmTest method setupAll.
@BeforeAll
public void setupAll() throws Exception {
tmpDir = Files.createTempDirectory(LocalAuthRealmTest.class.getName()).toFile();
assert tmpDir.exists();
conqueryTokenRealm = new ConqueryTokenRealm(storage);
realm = new LocalAuthenticationRealm(Validators.newValidator(), Jackson.BINARY_MAPPER, conqueryTokenRealm, "localtestRealm", tmpDir, new XodusConfig(), Duration.hours(1));
LifecycleUtils.init(realm);
}
use of com.bakdata.conquery.models.auth.basic.LocalAuthenticationRealm in project conquery by bakdata.
the class LocalAuthenticationConfig method createRealm.
@Override
public ConqueryAuthenticationRealm createRealm(ManagerNode manager) {
// Token extractor is not needed because this realm depends on the ConqueryTokenRealm
manager.getAuthController().getAuthenticationFilter().registerTokenExtractor(JWTokenHandler::extractToken);
LocalAuthenticationRealm realm = new LocalAuthenticationRealm(manager.getValidator(), Jackson.copyMapperAndInjectables(Jackson.BINARY_MAPPER), manager.getAuthController().getConqueryTokenRealm(), storeName, directory, passwordStoreConfig, jwtDuration);
UserAuthenticationManagementProcessor processor = new UserAuthenticationManagementProcessor(realm, manager.getStorage());
// Register resources for users to exchange username and password for an access token
registerAdminUnprotectedAuthenticationResources(manager.getUnprotectedAuthAdmin(), realm);
registerApiUnprotectedAuthenticationResources(manager.getUnprotectedAuthApi(), realm);
registerAuthenticationAdminResources(manager.getAdmin().getJerseyConfig(), processor);
// Add login schema for admin end
final RedirectingAuthFilter redirectingAuthFilter = manager.getAuthController().getRedirectingAuthFilter();
redirectingAuthFilter.getLoginInitiators().add(loginProvider(manager.getUnprotectedAuthAdmin()));
return realm;
}
Aggregations