Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use oidc discovery to resolve token endpoint #55

Merged
merged 5 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>de.medizininformatik-initiative</groupId>
<artifactId>mii-processes-common</artifactId>
<version>1.0.3.0</version>
<version>1.0.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ public class FhirClientConfig
private String fhirStoreProxyPassword;

@ProcessDocumentation(processNames = {
"medizininformatik-initiativede_reportSend" }, description = "The url of the oidc provider to request access tokens (token endpoint)", example = "http://foo.baz/realms/fhir-realm/protocol/openid-connect/token")
"medizininformatik-initiativede_reportSend" }, description = "The base url of the oidc provider", example = "http://foo.baz/realms/fhir-realm")
@Value("${de.medizininformatik.initiative.report.dic.fhir.server.oauth2.issuer.url:#{null}}")
private String fhirStoreOAuth2IssuerUrl;

@ProcessDocumentation(processNames = {
"medizininformatik-initiativede_reportSend" }, description = "The path for oidc discovery protocol", recommendation = "Change default value only if path differs from the oidc specification")
@Value("${de.medizininformatik.initiative.report.dic.fhir.server.oauth2.discovery.path:/.well-known/openid-configuration}")
private String fhirStoreOAuth2DiscoveryPath;

@ProcessDocumentation(processNames = {
"medizininformatik-initiativede_reportSend" }, description = "Identifier of the client (username) used for authentication when accessing the oidc provider token endpoint")
@Value("${de.medizininformatik.initiative.report.dic.fhir.server.oauth2.client.id:#{null}}")
Expand Down Expand Up @@ -147,6 +152,11 @@ public class FhirClientConfig
@Value("${de.medizininformatik.initiative.report.dic.fhir.server.oauth2.proxy.password:#{null}}")
private String fhirStoreOAuth2ProxyPassword;

@ProcessDocumentation(processNames = {
"medizininformatik-initiativede_reportSend" }, description = "If set to true, OIDC validation will only log a warning and not throw an illegal state exception")
@Value("${de.medizininformatik.initiative.report.dic.fhir.server.oauth2.discovery.validation.lenient:false}")
private boolean fhirStoreOAuth2DiscoveryValidationLenient;

@ProcessDocumentation(processNames = {
"medizininformatik-initiativede_reportSend" }, description = "To enable debug logging of FHIR resources set to `true`")
@Value("${de.medizininformatik.initiative.report.dic.fhir.dataLoggingEnabled:false}")
Expand Down Expand Up @@ -198,9 +208,10 @@ public TokenClient tokenClient()
: new String(api.getProxyConfig().getPassword());
}

return new OAuth2TokenClient(fhirStoreOAuth2IssuerUrl, fhirStoreOAuth2ClientId, fhirStoreOAuth2ClientSecret,
fhirStoreOAuth2ConnectTimeout, fhirStoreOAuth2SocketTimeout, trustStoreOAuth2Path, proxyUrl,
proxyUsername, proxyPassword);
return new OAuth2TokenClient(fhirStoreOAuth2IssuerUrl, fhirStoreOAuth2DiscoveryPath, fhirStoreOAuth2ClientId,
fhirStoreOAuth2ClientSecret, fhirStoreOAuth2ConnectTimeout, fhirStoreOAuth2SocketTimeout,
trustStoreOAuth2Path, proxyUrl, proxyUsername, proxyPassword,
fhirStoreOAuth2DiscoveryValidationLenient);
}

public DataLogger dataLogger()
Expand Down
Loading