diff --git a/dev/com.ibm.ws.security.openidconnect.client/src/com/ibm/ws/security/openidconnect/client/internal/AccessTokenAuthenticator.java b/dev/com.ibm.ws.security.openidconnect.client/src/com/ibm/ws/security/openidconnect/client/internal/AccessTokenAuthenticator.java index 8255a94c0c34..c06a5f92b501 100644 --- a/dev/com.ibm.ws.security.openidconnect.client/src/com/ibm/ws/security/openidconnect/client/internal/AccessTokenAuthenticator.java +++ b/dev/com.ibm.ws.security.openidconnect.client/src/com/ibm/ws/security/openidconnect/client/internal/AccessTokenAuthenticator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 IBM Corporation and others. + * Copyright (c) 2016, 2025 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -70,6 +70,7 @@ public class AccessTokenAuthenticator { private static final String JWT_SEGMENTS = "-segments"; private static final String JWT_SEGMENT_INDEX = "-"; private static final String BEARER_SCHEME = "Bearer "; + public static ThreadLocal threadClientID = new ThreadLocal(); OidcClientUtil oidcClientUtil = new OidcClientUtil(); SSLSupport sslSupport = null; @@ -105,6 +106,9 @@ public ProviderAuthenticationResult authenticate(HttpServletRequest req, oidcClientRequest.setTokenType(OidcClientRequest.TYPE_ACCESS_TOKEN); ProviderAuthenticationResult oidcResult = new ProviderAuthenticationResult(AuthResult.FAILURE, HttpServletResponse.SC_UNAUTHORIZED); String accessToken = null; + + setThreadClientId(clientConfig.getClientId()); + if (clientConfig.getAccessTokenInLtpaCookie()) { accessToken = getAccessTokenFromReqAsAttribute(req, true); } @@ -1104,4 +1108,11 @@ void logError(OidcClientConfig oidcClientConfig, boolean warningWhenSupported, O } } } + private void setThreadClientId(String clientID) { + threadClientID.set(clientID); + } + + public static String getThreadClientId() { + return threadClientID.get(); + } }