-
Notifications
You must be signed in to change notification settings - Fork 378
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
Add ClientInstanceTokenBinding type #2304
Add ClientInstanceTokenBinding type #2304
Conversation
@@ -1065,11 +1066,23 @@ private void handleTokenBinding(OAuth2AccessTokenReqDTO tokenReqDTO, String gran | |||
throw new IdentityOAuth2ClientException(OAuth2ErrorCodes.INVALID_REQUEST, | |||
"TLS certificate not found in the request."); | |||
} | |||
if (OAuth2Constants.TokenBinderType.CLIENT_INSTANCE.equals(tokenBinder.getBindingType())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having specific checks for implementation in the core is not a good practice. What is the reason for these checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the client instance has not sent any value, we treat as no binding type (as the binding is set to null by default)
throw new IdentityOAuth2Exception( | ||
"Token binding reference cannot be retrieved form the token binder: " + tokenBinder | ||
.getBindingType()); | ||
} | ||
|
||
if (OAuth2Constants.TokenBinderType.CLIENT_INSTANCE.equals(tokenBinder.getBindingType()) && | ||
tokenBindingValueOptional.get().length() >= MAX_ALLOWED_LENGTH) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we do this validation within the ClientInstanceTokenBinder itself ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can but we are unable to throw a client exception from the binder itself.
|
||
RequestParameter[] parameters = oAuth2AccessTokenReqDTO.getRequestParameters(); | ||
for (RequestParameter parameter : parameters) { | ||
if (CLIENT_INSTANCE_REF.equals(parameter.getKey()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we verify how easy is to send this parameter in the token request using the SDk ? does SDKs allow to add extra parameter in the token request ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, our SDKs do not support sending additional parameters. But wondering back-channel grant types like password/token-exchange require an SDK?
PR builder started |
PR builder completed |
PR builder started |
PR builder completed |
PR builder started |
PR builder completed |
There was a problem hiding this 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/7205280151
@@ -0,0 +1,108 @@ | |||
/* | |||
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we update License header
Proposed changes in this pull request
This PR adds new binding type where the client instance can send an identifier of its preference and request the IS to bind itself to the token. This provides the capability for grant types like password or token exchange where session/cookie based binding types cannot be used and also ensures each client instance gets token so that eventually the client has multiple active access token.
Fixes: wso2/product-is#18600
When should this PR be merged
[Please describe any preconditions that need to be addressed before we
can merge this pull request.]
Follow up actions
[List any possible follow-up actions here; for instance, testing data
migrations, software that we need to install on staging and production
environments.]
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation