Skip to content

Commit

Permalink
Merge pull request #80 from Akila94/fix-introspection-data-provider-main
Browse files Browse the repository at this point in the history
Improve introspection data provider to call the configured data provider before removing internal scopes
  • Loading branch information
aka4rKO authored Jul 1, 2024
2 parents 004a5ca + ddece1a commit 6213c67
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -27,7 +27,6 @@
import org.wso2.carbon.identity.oauth2.dto.OAuth2IntrospectionResponseDTO;
import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationRequestDTO;

import java.util.Collections;
import java.util.Map;

/**
Expand All @@ -41,14 +40,17 @@ public class OBIntrospectionDataProvider extends AbstractIdentityHandler impleme
public Map<String, Object> getIntrospectionData(OAuth2TokenValidationRequestDTO oAuth2TokenValidationRequestDTO,
OAuth2IntrospectionResponseDTO oAuth2IntrospectionResponseDTO)
throws IdentityOAuth2Exception {

Map<String, Object> additionalDataMap = getIntrospectionDataProvider()
.getIntrospectionData(oAuth2TokenValidationRequestDTO, oAuth2IntrospectionResponseDTO);
String[] nonInternalScopes = IdentityCommonUtil.removeInternalScopes(oAuth2IntrospectionResponseDTO.getScope()
.split(IdentityCommonConstants.SPACE_SEPARATOR));
oAuth2IntrospectionResponseDTO.setScope(StringUtils.join(nonInternalScopes,
IdentityCommonConstants.SPACE_SEPARATOR));
oAuth2IntrospectionResponseDTO.setProperties(Collections.singletonMap(IdentityCommonConstants.SCOPE,
StringUtils.join(nonInternalScopes, IdentityCommonConstants.SPACE_SEPARATOR)));
return getIntrospectionDataProvider().getIntrospectionData(oAuth2TokenValidationRequestDTO,
oAuth2IntrospectionResponseDTO);
additionalDataMap.put(IdentityCommonConstants.SCOPE, StringUtils.join(nonInternalScopes,
IdentityCommonConstants.SPACE_SEPARATOR));
oAuth2IntrospectionResponseDTO.setProperties(additionalDataMap);
return additionalDataMap;
}

public static IntrospectionDataProvider getIntrospectionDataProvider() {
Expand Down

0 comments on commit 6213c67

Please sign in to comment.