RED-6686 - fixes
This commit is contained in:
parent
a1a5741714
commit
e84ee1ae4f
3
.gitignore
vendored
3
.gitignore
vendored
@ -34,4 +34,5 @@ build/
|
||||
|
||||
.gradle/
|
||||
gradle.properties
|
||||
|
||||
gradlew
|
||||
gradlew.bat
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
package com.knecon.fforesight.tenantusermanagement;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
@ -16,6 +21,8 @@ import java.util.zip.ZipOutputStream;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -24,11 +31,16 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.StatementCallback;
|
||||
import org.springframework.jdbc.datasource.SingleConnectionDataSource;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.knecon.fforesight.tenantcommons.model.DatabaseConnection;
|
||||
import com.knecon.fforesight.tenantcommons.model.S3StorageConnection;
|
||||
import com.knecon.fforesight.tenantcommons.model.SearchConnection;
|
||||
import com.knecon.fforesight.tenantusermanagement.model.TenantRequest;
|
||||
import com.knecon.fforesight.tenantusermanagement.model.TenantUser;
|
||||
import com.knecon.fforesight.tenantusermanagement.model.User;
|
||||
import com.knecon.fforesight.tenantusermanagement.properties.TenantUserManagementProperties;
|
||||
import com.knecon.fforesight.tenantusermanagement.service.KeyCloakRoleManagerService;
|
||||
import com.knecon.fforesight.tenantusermanagement.service.RealmService;
|
||||
import com.knecon.fforesight.tenantusermanagement.service.TenantManagementService;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
@ -42,16 +54,22 @@ public class DevConfiguration {
|
||||
@Autowired
|
||||
private TenantManagementService tenantManagementService;
|
||||
@Autowired
|
||||
private KeyCloakRoleManagerService keyCloakRoleManagerService;
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
@Value("${spring.datasource.url:}")
|
||||
private String masterJDBCURL;
|
||||
@Autowired
|
||||
private TenantUserManagementProperties tenantUserManagementProperties;
|
||||
|
||||
@Autowired
|
||||
private RealmService realmService;
|
||||
|
||||
@PostConstruct
|
||||
@SneakyThrows
|
||||
public void postConstruct() {
|
||||
|
||||
|
||||
var tenant = 1;
|
||||
try {
|
||||
tenantManagementService.getTenant("tenant" + tenant);
|
||||
|
||||
@ -60,7 +60,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class TenantManagementService implements TenantProvider {
|
||||
|
||||
private static final Long MAX_WAIT_TIME = 60_000L; // 60 seconds
|
||||
|
||||
private static final String FRONTEND_URL_PROPERY = "frontendUrl";
|
||||
private static final Set<String> SUPPORTED_DATABASES = Set.of("postgresql");
|
||||
|
||||
private final EncryptionDecryptionService encryptionService;
|
||||
@ -75,6 +75,8 @@ public class TenantManagementService implements TenantProvider {
|
||||
@Value("${fforesight.tenant-exchange.name}")
|
||||
private String tenantExchangeName;
|
||||
|
||||
@Value("${fforesight.tenant-use-management.server-url:}")
|
||||
private String authServerUrl;
|
||||
|
||||
@SneakyThrows
|
||||
public void createTenant(TenantRequest tenantRequest) {
|
||||
@ -196,7 +198,7 @@ public class TenantManagementService implements TenantProvider {
|
||||
}
|
||||
|
||||
|
||||
private void createRealm(String tenantId, List<TenantUser> users) {
|
||||
public void createRealm(String tenantId, List<TenantUser> users) {
|
||||
|
||||
var realm = new RealmRepresentation();
|
||||
realm.setId(tenantId);
|
||||
@ -208,6 +210,8 @@ public class TenantManagementService implements TenantProvider {
|
||||
realm.setAccessTokenLifespan(tenantUserManagementProperties.getTenantAccessTokenLifeSpan());
|
||||
realm.setSsoSessionIdleTimeout(tenantUserManagementProperties.getSsoSessionIdleTimeout());
|
||||
|
||||
realm.getAttributesOrEmpty().put(FRONTEND_URL_PROPERY,authServerUrl);
|
||||
|
||||
var applicationClient = new ClientRepresentation();
|
||||
applicationClient.setEnabled(true);
|
||||
applicationClient.setName(tenantUserManagementProperties.getApplicationClientId());
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
fforesight:
|
||||
springdoc:
|
||||
default-tenant: 'redaction'
|
||||
tenant-user-management:
|
||||
application-client-id: 'redaction'
|
||||
application-name: 'RedactManager'
|
||||
@ -53,6 +51,5 @@ fforesight:
|
||||
permissions: ["fforesight-manage-user-preferences", "fforesight-read-all-users", "red-read-dossier", "red-read-app-configuration", "fforesight-read-general-configuration",
|
||||
"red-read-notification", "fforesight-read-users", "fforesight-update-my-profile", "red-update-notification", "fforesight-write-users", "red-read-license"]
|
||||
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
default-tenant: 'redaction'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user