Skip to content
Snippets Groups Projects
Commit 7d3c3841 authored by Jérôme LELEU's avatar Jérôme LELEU Committed by Benaissa BENARBIA
Browse files

CAS: Fix the providers reloading

parent 99ba7400
No related branches found
No related tags found
1 merge request!51Merge mis a jour vitam-ui
......@@ -66,36 +66,38 @@ public class Clients {
// the clients list has changed or has not been initialized yet
if (oldClientsHash == null || oldClientsHash.intValue() != clients.hashCode()) {
synchronized (this) {
clientsMap = new HashMap<>();
for (final var client : this.clients) {
final var name = client.getName();
CommonHelper.assertNotBlank("name", name);
final var lowerTrimmedName = name.toLowerCase().trim();
if (clientsMap.containsKey(lowerTrimmedName)) {
throw new TechnicalException("Duplicate name in clients: " + name);
}
clientsMap.put(lowerTrimmedName, client);
if (client instanceof IndirectClient) {
final var indirectClient = (IndirectClient) client;
if (this.callbackUrl != null && indirectClient.getCallbackUrl() == null) {
indirectClient.setCallbackUrl(this.callbackUrl);
}
if (this.urlResolver != null && indirectClient.getUrlResolver() == null) {
indirectClient.setUrlResolver(this.urlResolver);
if (oldClientsHash == null || oldClientsHash.intValue() != clients.hashCode()) {
clientsMap = new HashMap<>();
for (final var client : this.clients) {
final var name = client.getName();
CommonHelper.assertNotBlank("name", name);
final var lowerTrimmedName = name.toLowerCase().trim();
if (clientsMap.containsKey(lowerTrimmedName)) {
throw new TechnicalException("Duplicate name in clients: " + name);
}
if (this.callbackUrlResolver != null && indirectClient.getCallbackUrlResolver() == null) {
indirectClient.setCallbackUrlResolver(this.callbackUrlResolver);
clientsMap.put(lowerTrimmedName, client);
if (client instanceof IndirectClient) {
final var indirectClient = (IndirectClient) client;
if (this.callbackUrl != null && indirectClient.getCallbackUrl() == null) {
indirectClient.setCallbackUrl(this.callbackUrl);
}
if (this.urlResolver != null && indirectClient.getUrlResolver() == null) {
indirectClient.setUrlResolver(this.urlResolver);
}
if (this.callbackUrlResolver != null && indirectClient.getCallbackUrlResolver() == null) {
indirectClient.setCallbackUrlResolver(this.callbackUrlResolver);
}
if (this.ajaxRequestResolver != null && indirectClient.getAjaxRequestResolver() == null) {
indirectClient.setAjaxRequestResolver(this.ajaxRequestResolver);
}
}
if (this.ajaxRequestResolver != null && indirectClient.getAjaxRequestResolver() == null) {
indirectClient.setAjaxRequestResolver(this.ajaxRequestResolver);
final var baseClient = (BaseClient) client;
if (!authorizationGenerators.isEmpty()) {
baseClient.addAuthorizationGenerators(this.authorizationGenerators);
}
}
final var baseClient = (BaseClient) client;
if (!authorizationGenerators.isEmpty()) {
baseClient.addAuthorizationGenerators(this.authorizationGenerators);
}
this.oldClientsHash = this.clients.hashCode();
}
this.oldClientsHash = this.clients.hashCode();
}
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment