Skip to content

Commit

Permalink
feat(auth): add grant type and acr values to OIDC configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Lewis committed Jun 27, 2024
1 parent 1ae5bfc commit 35be1fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions datahub-frontend/app/auth/sso/oidc/OidcConfigs.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public Builder from(final com.typesafe.config.Config configs) {
responseType = getOptional(configs, OIDC_RESPONSE_TYPE);
responseMode = getOptional(configs, OIDC_RESPONSE_MODE);
useNonce = getOptional(configs, OIDC_USE_NONCE).map(Boolean::parseBoolean);
grantType = getOptional(configs, OIDC_GRANT_TYPE, DEFAULT_OIDC_GRANT_TYPE);
acrValues = getOptional(configs, OIDC_ACR_VALUES, DEFAULT_OIDC_ACR_VALUES);
customParamResource = getOptional(configs, OIDC_CUSTOM_PARAM_RESOURCE);
readTimeout = getOptional(configs, OIDC_READ_TIMEOUT, DEFAULT_OIDC_READ_TIMEOUT);
extractJwtAccessTokenClaims =
Expand Down
3 changes: 2 additions & 1 deletion datahub-frontend/app/auth/sso/oidc/OidcProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public SsoProtocol protocol() {
return SsoProtocol.OIDC;
}

private Client<OidcCredentials> createPac4jClient() {
private Client<OidcCredentials, OidcProfile> createPac4jClient() {
final OidcConfiguration oidcConfiguration = new OidcConfiguration();
oidcConfiguration.setClientId(_oidcConfigs.getClientId());
oidcConfiguration.setSecret(_oidcConfigs.getClientSecret());
Expand All @@ -75,6 +75,7 @@ private Client<OidcCredentials> createPac4jClient() {
oidcConfiguration.setPreferredJwsAlgorithm(preferred);
});

oidcConfiguration.setCustomParams(ImmutableMap.of("grant_type", _oidcConfigs.getGrantType(), "acr_values", _oidcConfigs.getAcrValues()));
final CustomOidcClient oidcClient = new CustomOidcClient(oidcConfiguration);
oidcClient.setName(OIDC_CLIENT_NAME);
oidcClient.setCallbackUrl(
Expand Down
3 changes: 3 additions & 0 deletions datahub-frontend/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ auth.oidc.readTimeout = ${?AUTH_OIDC_READ_TIMEOUT}
auth.oidc.extractJwtAccessTokenClaims = ${?AUTH_OIDC_EXTRACT_JWT_ACCESS_TOKEN_CLAIMS} # Whether to extract claims from JWT access token. Defaults to false.
auth.oidc.preferredJwsAlgorithm = ${?AUTH_OIDC_PREFERRED_JWS_ALGORITHM} # Which jws algorithm to use

auth.oidc.acrValues = ${?AUTH_OIDC_ACR_VALUES}
auth.oidc.grantType = ${?AUTH_OIDC_GRANT_TYPE}

#
# By default, the callback URL that should be registered with the identity provider is computed as {$baseUrl}/callback/oidc.
# For example, the default callback URL for a local deployment of DataHub would be "http://localhost:9002/callback/oidc".
Expand Down

0 comments on commit 35be1fb

Please sign in to comment.