in src/main/java/com/epam/digital/data/platform/gateway/filter/ClientRegistrySetTokenGatewayFilter.java [81:95]
private Optional<KeycloakAuthRequestInfo> getAuthInfoFromVault(ServerWebExchange exchange) {
Map<String, String> pathVariables =
exchange.getAttribute(ServerWebExchangeUtils.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
var targetRegistry = pathVariables.get(REGISTRY_NAME_URL_PATH_VARIABLE);
var vaultPath = String.format(VAULT_PATTERN, targetRegistry, clientRegistry);
try {
var response =
vaultTemplate
.opsForKeyValue(VAULT_PREFIX, KeyValueBackend.KV_2)
.get(vaultPath, KeycloakAuthRequestInfo.class);
return Optional.ofNullable(response).map(VaultResponseSupport::getData);
} catch (Exception e) {
throw new VaultDataRetrievingException("Error while communicating with vault", e);
}
}