-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Allow hooks or extensions to OAuth2__GrantType__AuthenticationProviders #1075
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
Comments
@Yneth thanks for reaching out!
Both OAuth2TokenGenerator and OAuth2TokenCustomizer are available for this purpose. The reference guide has an example of constructing your own A common pattern would be to use delegation to customize before/after the token generation process. Another would be to simply use the token customizer. The How-to: Customize the OpenID Connect 1.0 UserInfo response has an example of customizing just the access token (with an
Can you explain more about why you had to do this? Or does the above explanation help you get ideas for improvement?
Can you provide more details on your use case here? It's not clear to me yet what you weren't able to accomplish with the existing customization hooks. |
Our case is looking the following way: I do not like that we have to:
The desired use case would look something like this:
|
Hi @Yneth! Thanks for the extra information.
I not quite sure I understand this point, can you clarify what you mean here? Are you using the
This isn't really the primary goal of adding customization hooks. The primary goal would be to solve for use cases which are not currently possible. A second goal would be to promote code reuse. There are many ways to achieve a desired outcome, but it becomes much harder for everyone if a good existing option is off the table for this reason alone. Additionally, you can always separate concerns into multiple implementations (classes) and use delegation when needed.
I agree that something like this could be quite valuable here! We already have
I think I see the use case here. You're trying to perform an operation (e.g. create a session) in one of the calls to the token generator, and then share information from that operation (e.g. session id) in each of the calls to the token customizer. Is that a good summary? |
@Yneth please see my above question.
Also, can you confirm that I'm understanding your use case?
|
yes, thats correct. we create session before access token and then need to share sessionId via HttpServletRequest.getAttribute during generation of openId and refresh tokens
we are using |
Thanks for confirming @Yneth! I think that adding some more flexible customization options and hooks into the processing flow is needed. I see a customization theme already with a few other issues, such as gh-1003, gh-925, gh-884 and others. While those are not strictly related, I think it's pretty clear that there are numerous spots where we need hooks into the flow. We've already been thinking about this quite a bit, so I'm going to keep this issue open for the meantime as a reminder about the specific need to add hooks into the processing flow of the |
@sjohnr sounds amazing |
@Yneth I reviewed all the comments in this issue and I would prefer that you submit 2 separate issues for each of your enhancement requests, as per comment:
When submitting the new issues, please provide as much detail as possible. The request for Addition 1 is clear but Addition 2 is not clear to me so please provide more details there. I'm going to close this issue and we can continue the conversation when you open the new issues. |
I am integrating OAuth into existing platform, and we have user sessions. User session is a separate entity, that is living in other service, meaning it is not a HTTP session. I need to add user session creation to TokenEndpoint, such that session is created and its' id is included in token claims. The best place to add session creation is after
OAuth2AuthorizationCodeAuthenticationProvider
orOAuth2RefreshTokenAuthenticationProvider
validation and before token generation.Unfortunately, there are no points of customisation in that place.
In order to overcome this issue we have to create custom token generator that has extended responsibilities and generates session only on accessToken type and generates tokens.
It would be nice to have some kind of hooks such that users will be able to customize the behaviour and update OAuth2Context if there are any variables to share with other components of the flow.
The text was updated successfully, but these errors were encountered: