From 08360a5efd9a7c555d13fb8c827db167c6c4ad1c Mon Sep 17 00:00:00 2001 From: Avarjana Date: Thu, 27 Jun 2024 12:24:39 +0530 Subject: [PATCH] Add null check for MDC values --- .../auth/service/handler/impl/OAuth2AccessTokenHandler.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/org.wso2.carbon.identity.auth.service/src/main/java/org/wso2/carbon/identity/auth/service/handler/impl/OAuth2AccessTokenHandler.java b/components/org.wso2.carbon.identity.auth.service/src/main/java/org/wso2/carbon/identity/auth/service/handler/impl/OAuth2AccessTokenHandler.java index 920a5ce7..d6a15e40 100644 --- a/components/org.wso2.carbon.identity.auth.service/src/main/java/org/wso2/carbon/identity/auth/service/handler/impl/OAuth2AccessTokenHandler.java +++ b/components/org.wso2.carbon.identity.auth.service/src/main/java/org/wso2/carbon/identity/auth/service/handler/impl/OAuth2AccessTokenHandler.java @@ -204,16 +204,15 @@ protected AuthenticationResult doAuthenticate(MessageContext messageContext) { if (serviceProviderName != null){ authenticationContext.addParameter(SERVICE_PROVIDER_NAME, serviceProviderName); + MDC.put(SERVICE_PROVIDER_NAME, serviceProviderName); } if (serviceProviderTenantDomain != null) { authenticationContext.addParameter(SERVICE_PROVIDER_TENANT_DOMAIN, serviceProviderTenantDomain); } if (serviceProviderUUID != null) { authenticationContext.addParameter(SERVICE_PROVIDER_UUID, serviceProviderUUID); + MDC.put(SERVICE_PROVIDER_UUID, serviceProviderUUID); } - - MDC.put(SERVICE_PROVIDER_NAME, serviceProviderName); - MDC.put(SERVICE_PROVIDER_UUID, serviceProviderUUID); // Set OAuth service provider details to be consumed by the provisioning framework. setProvisioningServiceProviderThreadLocal(oAuth2IntrospectionResponseDTO.getClientId(), serviceProviderTenantDomain);