-
Notifications
You must be signed in to change notification settings - Fork 6k
Provide Cookie implementation of AuthorizationRequestRepository #6374
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
Hi @jgrandja, How many votes do you need? |
Hi @afrancoc2000. There is no specific number of votes we target but this one has enough to start prioritizing. However, we are pretty jammed with higher priority tasks that need to get into the upcoming 5.2 release so this one will take lower priority. It would be helpful if someone from the community would contribute a PR for this as I believe it would be fairly trivial. Would you be interested in submitting a PR? |
@afrancoc2000 Can you provide details on why you require a cookie implementation of Anyone else interested in this feature, I'd like to hear from you as well and your use case so I can understand the reasoning for needing such an implementation. |
Sure the reason is microservices applications, today the best way of handling this type of apps is making them stateless so any app can respond to any request. The authorization can be easily saved and restored from a jwt cookie thats better than having a session because for sessions I need an extra component like a redis cache, that means more infrastructure, more points of failure and the posiblility of conflicts between sessions, problems that could be easily solved by replacing a couple lines of code. Also that allows me to link an external frontend more easily just by passing the jwt cookie that is a standard in the industry. I would love to help I was looking at the example of @naturalprogrammer in this links: link 1, link 2 but found out that storing the OAuth2AuthorizationRequest is not enough and I would prefer to do the implementation with a jwt cookie saving and restoring the security context, haven't got till there yet. |
@afrancoc2000 The It does not save a
Please correct me if I'm misunderstanding your comments? |
I was hoping to use the cookie based approach, because I am trying to use spring-oidc to authenticate to multiple providers, but wanted to do it in a seemless manner. If I implement a cookie-base request repository, and maybe write a cookie from javascript, when the response comes back, it will have a request in the cookie format and will let the flow go to my endpoint instead of intercepting it and returning me a the oidc login page. |
Would simply saving the serialized |
We would not want to perform Java serialization/deserialization as that can lead to a lot of different types of attacks. The cookie would need to be written as a String that did not allow attackers to control the Java objects that were being created. |
Alright, is there a need to encrypt or sign the cookie? |
I cannot think of any reason to do this. The user can make changes to the cookie, but it only impacts their own security and not much different than tampering with redirect URLs sent from the server. |
If we want to avoid (de)serialization, how do we deal with |
You would need to use Spring's Conversion APIs to convert it to/from a String. You would avoid including the type information in the String as that is what is used for deserialization attacks. |
Any updates on this issue? |
@milanov There are no updates. Quite honestly, I'm reconsidering on NOT providing this feature. There are a few vulnerabilities around Cookie tampering so I'm hesitant to proceed with this feature. If the main motivation for this feature is to achieve statelessness, then providing a Cookie based implementation of The key point I want to emphasize is that storing secret/private information on the server is the most secure way and transporting secret/private information over secure and/or un-secure channels is NOT the most secure in certain scenarios. I'd like to hear more from the community on the motivation for this feature, in case I'm missing something. |
In our case the motivation is exactly statelessness. If login is attempted on one of our instances, then performed at an IdP and the user is redirected back, we'll have to resort to special measures to ensure that the same instance handles the request, in order to have matching state and complete the login process. I guess we can use a shared storage-backed |
This can be achieved today with the help of Spring Session. Please see gh-7889 for complete details on how to setup and configure to support application clustering. |
We should consider providing a
Cookie
based implementation ofAuthorizationRequestRepository
.The text was updated successfully, but these errors were encountered: