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

Fix b2b app owner sharing #261

Merged
merged 2 commits into from
Jan 22, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import java.util.Optional;

import static org.wso2.carbon.identity.auth.service.util.AuthConfigurationUtil.isAuthHeaderMatch;
import static org.wso2.carbon.identity.auth.service.util.Constants.AUTHENTICATION_TYPE;
import static org.wso2.carbon.identity.auth.service.util.Constants.IDP_NAME;
import static org.wso2.carbon.identity.auth.service.util.Constants.IS_FEDERATED_USER;
import static org.wso2.carbon.identity.auth.service.util.Constants.OAUTH2_ALLOWED_SCOPES;
Expand Down Expand Up @@ -114,6 +115,9 @@ protected AuthenticationResult doAuthenticate(MessageContext messageContext) {
OAuth2IntrospectionResponseDTO oAuth2IntrospectionResponseDTO =
oAuth2TokenValidationService.buildIntrospectionResponse(requestDTO);

IdentityUtil.threadLocalProperties.get()
.put(AUTHENTICATION_TYPE, oAuth2IntrospectionResponseDTO.getAut());
PasinduYeshan marked this conversation as resolved.
Show resolved Hide resolved

if (!oAuth2IntrospectionResponseDTO.isActive()) {
return authenticationResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ public class Constants {
public static final String BASIC_AUTHENTICATION = "BasicAuthentication";
public static final String ENABLE_BASIC_AUTH_HANDLER_CONFIG = "EnableBasicAuthHandler";
public static final String RESOURCE_ACCESS_CONTROL_V2_FILE = "resource-access-control-v2.xml";
public static final String AUTHENTICATION_TYPE = "authenticationType";
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ public void invoke(Request request, Response response) throws IOException, Servl
unsetMDCThreadLocals();
// Clear thread local authenticated with basic auth flag.
unsetAuthenticatedWithBasicAuth();
// Clear thread local authentication type.
unsetThreadLocalAuthenticationType();
}


Expand Down Expand Up @@ -236,6 +238,11 @@ private void unsetThreadLocalServiceProvider() {
IdentityUtil.threadLocalProperties.get().remove(SERVICE_PROVIDER_TENANT_DOMAIN);
}

private void unsetThreadLocalAuthenticationType() {

IdentityUtil.threadLocalProperties.get().remove(Constants.AUTHENTICATION_TYPE);
}

private void setThreadLocalAuthUserTenantDomain(AuthenticationContext authenticationContext) {

if (authenticationContext.getUser() != null) {
Expand Down
Loading