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

Allow sub organization applications to consume tokens from the valve level #302

Conversation

ShanChathusanda93
Copy link
Contributor

Proposed changes in this pull request

@@ -174,7 +174,8 @@ protected AuthenticationResult doAuthenticate(MessageContext messageContext) {
String serviceProviderName = null;
String serviceProviderUUID = null;
try {
serviceProvider = OAuth2Util.getServiceProvider(oAuth2IntrospectionResponseDTO.getClientId());
serviceProvider = OAuth2Util.getServiceProvider(oAuth2IntrospectionResponseDTO.getClientId(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we check whether this can have impact on custom grant types where authorized user does not reside in application tenant domain. (May be we can try with a SaaS app first)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the implementation

@ShanChathusanda93 ShanChathusanda93 force-pushed the sub-org-app-token-valid-branch branch from 4aeaacf to ffce052 Compare January 22, 2025 05:33
@ShanChathusanda93 ShanChathusanda93 changed the title Allow sub organization applications to issue tokens from the valve level Allow sub organization applications to issue and consume tokens from the valve level Jan 22, 2025
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 34 lines in your changes missing coverage. Please review.

Project coverage is 3.59%. Comparing base (00ba557) to head (ed34989).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
...service/handler/impl/OAuth2AccessTokenHandler.java 0.00% 34 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             master    #302      +/-   ##
===========================================
- Coverage      3.66%   3.59%   -0.08%     
  Complexity       20      20              
===========================================
  Files            36      36              
  Lines          1529    1559      +30     
  Branches        254     265      +11     
===========================================
  Hits             56      56              
- Misses         1472    1502      +30     
  Partials          1       1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ShanChathusanda93 ShanChathusanda93 force-pushed the sub-org-app-token-valid-branch branch from ffce052 to 15c716a Compare January 22, 2025 07:54
@ShanChathusanda93 ShanChathusanda93 changed the title Allow sub organization applications to issue and consume tokens from the valve level Allow sub organization applications to consume tokens from the valve level Jan 22, 2025
@ShanChathusanda93 ShanChathusanda93 force-pushed the sub-org-app-token-valid-branch branch from 15c716a to bde18c2 Compare January 22, 2025 08:30
Comment on lines +97 to +104
if (StringUtils.equals(organizationID, ((AuthenticatedUser) user).getAccessingOrganization())) {
return true;
} else {
OAuthAppDO oAuthAppDO = (OAuthAppDO) authenticationContext.getParameter(
Constants.AUTH_CONTEXT_OAUTH_APP_PROPERTY);
tenantDomain = OAuth2Util.getTenantDomainOfOauthApp(oAuthAppDO);
return StringUtils.equals(((AuthenticatedUser) user).getAccessingOrganization(), tenantDomain);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At which point this code get executed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are talking about the else part, that will be executed when a request comes from /t/{tenant-domain}/o/{org-id} pattern.

@AnuradhaSK
Copy link
Contributor

create an issue to track unit test addition

@ShanChathusanda93 ShanChathusanda93 force-pushed the sub-org-app-token-valid-branch branch from bde18c2 to ed34989 Compare January 26, 2025 13:10
@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/12975014116

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/12975014116
Status: success

Copy link

@jenkins-is-staging jenkins-is-staging left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/12975014116

@AnuradhaSK AnuradhaSK merged commit 5ada1d5 into wso2-extensions:master Jan 26, 2025
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants