Skip to content

Commit

Permalink
[ELY-2290] Update OidcClientConfiguration#resetUrls to handle the cas…
Browse files Browse the repository at this point in the history
…e where the provider-url or auth-server-url isn't valid
  • Loading branch information
fjuma committed Jan 17, 2022
1 parent 997b176 commit d156262
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ interface ElytronMessages extends BasicLogger {
@Message(id = 23048, value = "Invalid URI: '%s'")
RuntimeException invalidUri(String uri);


@LogMessage(level = WARN)
@Message(id = 23049, value = "Invalid 'auth-server-url' or 'provider-url': '%s'")
void invalidAuthServerUrlOrProviderUrl(String url);

}

Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,16 @@ protected void resetUrls() {
jwksUrl = null;
relativeUrls = null;
if (providerUrl != null || authServerBaseUrl != null) {
URI uri = URI.create(providerUrl != null? providerUrl : authServerBaseUrl);
if (uri.getHost() == null) {
relativeUrls = RelativeUrlsUsed.ALWAYS;
} else {
// We have absolute URI in config
relativeUrls = RelativeUrlsUsed.NEVER;
try {
URI uri = URI.create(providerUrl != null ? providerUrl : authServerBaseUrl);
if (uri.getHost() == null) {
relativeUrls = RelativeUrlsUsed.ALWAYS;
} else {
// We have absolute URI in config
relativeUrls = RelativeUrlsUsed.NEVER;
}
} catch (Exception e) {
log.invalidAuthServerUrlOrProviderUrl(providerUrl != null ? providerUrl : authServerBaseUrl);
}
}
}
Expand Down

0 comments on commit d156262

Please sign in to comment.