From 237aca6e2206b6dc5a350f986ab6cc330e40f449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 27 May 2022 09:24:11 +0200 Subject: [PATCH] docfix/TODO Set token_endpoint_auth_method in accordance to the Consumer.AppType value --- .../main/scala/code/snippet/ConsumerRegistration.scala | 9 ++++++--- obp-api/src/main/scala/code/util/HydraUtil.scala | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/obp-api/src/main/scala/code/snippet/ConsumerRegistration.scala b/obp-api/src/main/scala/code/snippet/ConsumerRegistration.scala index 61e43dcc9..4e559d2ff 100644 --- a/obp-api/src/main/scala/code/snippet/ConsumerRegistration.scala +++ b/obp-api/src/main/scala/code/snippet/ConsumerRegistration.scala @@ -136,9 +136,12 @@ class ConsumerRegistration extends MdcLoggable { HydraUtil.createHydraClient(consumer, oAuth2Client => { val signingAlg = signingAlgVar.is - val hydraTokenEndpointAuthMethod = - APIUtil.getPropsValue("hydra_token_endpoint_auth_method", "private_key_jwt") - oAuth2Client.setTokenEndpointAuthMethod(hydraTokenEndpointAuthMethod) + // TODO Set token_endpoint_auth_method in accordance to the Consumer.AppType value + // Consumer.AppType = Confidential => client_secret_post + // Consumer.AppType = Public => private_key_jwt + // Consumer.AppType = Unknown => private_key_jwt + oAuth2Client.setTokenEndpointAuthMethod(HydraUtil.hydraTokenEndpointAuthMethod) + oAuth2Client.setTokenEndpointAuthSigningAlg(signingAlg) oAuth2Client.setRequestObjectSigningAlg(signingAlg) diff --git a/obp-api/src/main/scala/code/util/HydraUtil.scala b/obp-api/src/main/scala/code/util/HydraUtil.scala index b69a6a251..16c2d36a9 100644 --- a/obp-api/src/main/scala/code/util/HydraUtil.scala +++ b/obp-api/src/main/scala/code/util/HydraUtil.scala @@ -25,6 +25,9 @@ object HydraUtil extends MdcLoggable{ val mirrorConsumerInHydra = APIUtil.getPropsAsBoolValue("mirror_consumer_in_hydra", false) + val hydraTokenEndpointAuthMethod = + APIUtil.getPropsValue("hydra_token_endpoint_auth_method", "private_key_jwt") + lazy val hydraPublicUrl = APIUtil.getPropsValue("hydra_public_url") .openOrThrowException(s"If props $INTEGRATE_WITH_HYDRA is true, hydra_public_url value should not be blank") .replaceFirst("/$", "") @@ -87,7 +90,11 @@ object HydraUtil extends MdcLoggable{ val clientMeta = Map("client_certificate" -> consumer.clientCertificate.get).asJava oAuth2Client.setMetadata(clientMeta) } - oAuth2Client.setTokenEndpointAuthMethod("client_secret_post") + // TODO Set token_endpoint_auth_method in accordance to the Consumer.AppType value + // Consumer.AppType = Confidential => client_secret_post + // Consumer.AppType = Public => private_key_jwt + // Consumer.AppType = Unknown => private_key_jwt + oAuth2Client.setTokenEndpointAuthMethod(HydraUtil.hydraTokenEndpointAuthMethod) val decoratedClient = fun(oAuth2Client) val oAuth2ClientResult = Some(hydraAdmin.createOAuth2Client(decoratedClient))