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

Improve Recipient Validation in SAML2 Bearer Grant #21989

Open
ImalshaG opened this issue Dec 10, 2024 · 0 comments
Open

Improve Recipient Validation in SAML2 Bearer Grant #21989

ImalshaG opened this issue Dec 10, 2024 · 0 comments

Comments

@ImalshaG
Copy link
Contributor

Current Limitation

In the SAML2 Bearer Grant type, there is a recipient validation at [1] where we check whether the recipient list in the saml assertion contains the token endpoint alias of the IS. This behaviour has been implemented to align with the specification [2] which states:

The authorization server MUST verify that the value of the Recipient attribute matches the token endpoint URL (or an acceptable alias) to which the Assertion was delivered.

However, there has been requirements where the saml bearer grant needs to be used to exchange a saml assertion issued by a third party IDP which does not support adding multiple recipients. In such cases, the ACS url will be considered as the recipient of the assertion and if the ACS is in a trusted domain, the above recipient validation can be improved to allow such trusted recipients to be considered for the validation instead of only checking for the token endpoint of IS.

[1] https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/v7.0.195/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/token/handlers/grant/saml/SAML2BearerGrantHandler.java#L506
[2] https://datatracker.ietf.org/doc/html/draft-ietf-oauth-saml2-bearer

Suggested Improvement

Improve the recipient validation logic in the SAML2BearerGrantHandler to provide the ability to configure multiple token endpoint aliases or multiple optional values that can be expected as recipients in the saml assertion. Therefore if a third party IDP has support to only send 1 recipient in the saml assertion, if the recipient is a trusted party then it can be considered during the recipient validation at [1] instead of looking only for the token endpoint alias.

[1] https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/v7.0.195/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/token/handlers/grant/saml/SAML2BearerGrantHandler.java#L509

Version

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant