Skip to content
Snippets Groups Projects
Verified Commit 4465db3b authored by Martin Weise's avatar Martin Weise
Browse files

Added more flags

parent 7cbd0f8f
No related branches found
No related tags found
4 merge requests!231CI: Remove build for log-service,!228Better error message handling in the frontend,!223Release of version 1.4.0,!190Resolve "More env variables for Azure deployment"
...@@ -23,6 +23,7 @@ build-analyse-service: ...@@ -23,6 +23,7 @@ build-analyse-service:
build-docker: build-docker:
docker build -t dbrepo-metadata-service:build --target build dbrepo-metadata-service docker build -t dbrepo-metadata-service:build --target build dbrepo-metadata-service
docker build -t dbrepo-search-sync-agent:build --target build dbrepo-search-sync-agent
docker compose build --parallel docker compose build --parallel
build-frontend: build-frontend:
......
...@@ -56,7 +56,7 @@ fda: ...@@ -56,7 +56,7 @@ fda:
issuer: http://localhost/realms/dbrepo issuer: http://localhost/realms/dbrepo
public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqnHQ2BWWW9vDNLRCcxD++xZg/16oqMo/c1l+lcFEjjAIJjJp/HqrPYU/U9GvquGE6PbVFtTzW1KcKawOW+FJNOA3CGo8Q1TFEfz43B8rZpKsFbJKvQGVv1Z4HaKPvLUm7iMm8Hv91cLduuoWx6Q3DPe2vg13GKKEZe7UFghF+0T9u8EKzA/XqQ0OiICmsmYPbwvf9N3bCKsB/Y10EYmZRb8IhCoV9mmO5TxgWgiuNeCTtNCv2ePYqL/U0WvyGFW0reasIK8eg3KrAUj8DpyOgPOVBn3lBGf+3KFSYi+0bwZbJZWqbC/Xlk20Go1YfeJPRIt7ImxD27R/lNjgDO/MwIDAQAB public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqnHQ2BWWW9vDNLRCcxD++xZg/16oqMo/c1l+lcFEjjAIJjJp/HqrPYU/U9GvquGE6PbVFtTzW1KcKawOW+FJNOA3CGo8Q1TFEfz43B8rZpKsFbJKvQGVv1Z4HaKPvLUm7iMm8Hv91cLduuoWx6Q3DPe2vg13GKKEZe7UFghF+0T9u8EKzA/XqQ0OiICmsmYPbwvf9N3bCKsB/Y10EYmZRb8IhCoV9mmO5TxgWgiuNeCTtNCv2ePYqL/U0WvyGFW0reasIK8eg3KrAUj8DpyOgPOVBn3lBGf+3KFSYi+0bwZbJZWqbC/Xlk20Go1YfeJPRIt7ImxD27R/lNjgDO/MwIDAQAB
keycloak: keycloak:
endpoint: "http://authentication-service:8080/api/auth" endpoint: "http://authentication-service:8080"
username: fda username: fda
password: fda password: fda
consumers: 2 consumers: 2
......
...@@ -41,10 +41,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway { ...@@ -41,10 +41,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway {
payload.add("password", keycloakConfig.getKeycloakPassword()); payload.add("password", keycloakConfig.getKeycloakPassword());
payload.add("grant_type", "password"); payload.add("grant_type", "password");
payload.add("client_id", "admin-cli"); payload.add("client_id", "admin-cli");
final String url = keycloakConfig.getKeycloakEndpoint() + "/realms/master/protocol/openid-connect/token";
log.debug("request admin token from url {}", url);
final ResponseEntity<TokenDto> response; final ResponseEntity<TokenDto> response;
try { try {
response = restTemplate.exchange("/realms/master/protocol/openid-connect/token", response = restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(payload, headers), TokenDto.class);
HttpMethod.POST, new HttpEntity<>(payload, headers), TokenDto.class);
} catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) { } catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) {
log.error("Failed to obtain admin token: {}", e.getMessage()); log.error("Failed to obtain admin token: {}", e.getMessage());
throw new AccessDeniedException("Failed to obtain admin token: " + e.getMessage()); throw new AccessDeniedException("Failed to obtain admin token: " + e.getMessage());
...@@ -59,10 +60,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway { ...@@ -59,10 +60,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway {
final HttpHeaders headers = new HttpHeaders(); final HttpHeaders headers = new HttpHeaders();
headers.set("Accept", "application/json"); headers.set("Accept", "application/json");
headers.set("Authorization", "Bearer " + obtainToken().getAccessToken()); headers.set("Authorization", "Bearer " + obtainToken().getAccessToken());
final String url = keycloakConfig.getKeycloakEndpoint() + "/admin/realms/dbrepo/users";
log.debug("create user at url {}", url);
final ResponseEntity<Void> response; final ResponseEntity<Void> response;
try { try {
response = restTemplate.exchange("/admin/realms/dbrepo/users", HttpMethod.POST, response = restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(data, headers), Void.class);
new HttpEntity<>(data, headers), Void.class);
} catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) { } catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) {
log.error("Failed to create user: {}", e.getMessage()); log.error("Failed to create user: {}", e.getMessage());
throw new KeycloakRemoteException("Failed to create user: " + e.getMessage()); throw new KeycloakRemoteException("Failed to create user: " + e.getMessage());
...@@ -89,10 +91,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway { ...@@ -89,10 +91,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway {
headers.set("Accept", "application/json"); headers.set("Accept", "application/json");
headers.set("Authorization", "Bearer " + obtainToken().getAccessToken()); headers.set("Authorization", "Bearer " + obtainToken().getAccessToken());
final UpdateCredentialsDto payload = userMapper.passwordToUpdateCredentialsDto(data.getPassword()); final UpdateCredentialsDto payload = userMapper.passwordToUpdateCredentialsDto(data.getPassword());
final String url = keycloakConfig.getKeycloakEndpoint() + "/admin/realms/dbrepo/users/" + id;
log.debug("update user credentials at url {}", url);
final ResponseEntity<Void> response; final ResponseEntity<Void> response;
try { try {
response = restTemplate.exchange("/admin/realms/dbrepo/users/" + id, HttpMethod.PUT, response = restTemplate.exchange(url, HttpMethod.PUT, new HttpEntity<>(payload, headers), Void.class);
new HttpEntity<>(payload, headers), Void.class);
} catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) { } catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) {
log.error("Failed to update user credentials: {}", e.getMessage()); log.error("Failed to update user credentials: {}", e.getMessage());
throw new KeycloakRemoteException("Failed to update user credentials: " + e.getMessage()); throw new KeycloakRemoteException("Failed to update user credentials: " + e.getMessage());
...@@ -110,10 +113,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway { ...@@ -110,10 +113,11 @@ public class KeycloakGatewayImpl implements KeycloakGateway {
final HttpHeaders headers = new HttpHeaders(); final HttpHeaders headers = new HttpHeaders();
headers.set("Accept", "application/json"); headers.set("Accept", "application/json");
headers.set("Authorization", "Bearer " + obtainToken().getAccessToken()); headers.set("Authorization", "Bearer " + obtainToken().getAccessToken());
final String url = keycloakConfig.getKeycloakEndpoint() + "/admin/realms/dbrepo/users/?username=" + username;
log.debug("find user from url {}", url);
final ResponseEntity<UserDto[]> response; final ResponseEntity<UserDto[]> response;
try { try {
response = restTemplate.exchange("/admin/realms/dbrepo/users/?username=" + username, response = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(null, headers), UserDto[].class);
HttpMethod.GET, new HttpEntity<>(null, headers), UserDto[].class);
} catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) { } catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) {
log.error("Failed to find user: {}", e.getMessage()); log.error("Failed to find user: {}", e.getMessage());
throw new KeycloakRemoteException("Failed to find user: " + e.getMessage()); throw new KeycloakRemoteException("Failed to find user: " + e.getMessage());
......
...@@ -24,10 +24,11 @@ FROM openjdk:17-alpine as runtime ...@@ -24,10 +24,11 @@ FROM openjdk:17-alpine as runtime
MAINTAINER Martin Weise <martin.weise@tuwien.ac.at> MAINTAINER Martin Weise <martin.weise@tuwien.ac.at>
ENV METADATA_DB=fda ENV METADATA_DB=fda
ENV METADATA_HOST=metadata-db
ENV METADATA_JDBC_EXTRA_ARGS=""
ENV METADATA_PASSWORD=dbrepo
ENV METADATA_USERNAME=root ENV METADATA_USERNAME=root
ENV METADATA_PASSWORD=dbrepo ENV METADATA_PASSWORD=dbrepo
ENV BROKER_USERNAME=fda
ENV BROKER_PASSWORD=fda
ENV SEARCH_USERNAME=fda ENV SEARCH_USERNAME=fda
ENV SEARCH_PASSWORD=fda ENV SEARCH_PASSWORD=fda
ENV LOG_LEVEL=debug ENV LOG_LEVEL=debug
......
...@@ -4,7 +4,7 @@ spring: ...@@ -4,7 +4,7 @@ spring:
autoconfigure: autoconfigure:
exclude: org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration, org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration exclude: org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration, org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration
datasource: datasource:
url: "jdbc:mariadb://metadata-db:3306/${METADATA_DB}" url: "jdbc:mariadb://${METADATA_HOST}:3306/${METADATA_DB}${METADATA_JDBC_EXTRA_ARGS}"
driver-class-name: org.mariadb.jdbc.Driver driver-class-name: org.mariadb.jdbc.Driver
username: "${METADATA_USERNAME}" username: "${METADATA_USERNAME}"
password: "${METADATA_PASSWORD}" password: "${METADATA_PASSWORD}"
...@@ -25,15 +25,13 @@ spring: ...@@ -25,15 +25,13 @@ spring:
jdbc: jdbc:
time_zone: UTC time_zone: UTC
application: application:
name: search-startup-agent name: search-sync-agent
opensearch: opensearch:
username: "${SEARCH_USERNAME}" username: "${SEARCH_USERNAME}"
password: "${SEARCH_PASSWORD}" password: "${SEARCH_PASSWORD}"
host: search-db host: search-db
port: 9200 port: 9200
protocol: http protocol: http
cloud:
loadbalancer.ribbon.enabled: false
management: management:
endpoints: endpoints:
web: web:
......
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
computed: { computed: {
loadingColor () { loadingColor () {
return this.error ? 'red lighten-2' : 'primary' return this.error ? 'red lighten-2' : 'primary'
}, }
}, },
mounted () { mounted () {
this.loadUsers() this.loadUsers()
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment