-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Cookie-based Bearer Token support #9230
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
@jzheaux May I ask if there are any plans to support this in one of the next releases? |
Create a custom logic for passing the bearer token via HTTP only cookies between server and client. Look here: https://youtu.be/vmEWywGzWbA |
This is still under consideration as the best practices document is still in draft. The idiomatic way to customize how the token is resolved is by publishing a bearer token resolver bean like so: @Bean
BearerTokenResolver cookieBasedBearerTokenResolver() {
return (request) -> extractTokenFromCookie(request);
} Note that the current draft recommends that any JWT Cookie must be Also, note that the recommended pattern is a BFF which often eliminates the need for a JWT cookie since the session cookie is already present and the JWT can be looked up from there. |
The section at the top of this issue appears to have been removed from the draft. There is now nothing about using a Cookie to transport bearer tokens from the browser to the protected API. Is there any reason to implement this now that it is apparently no longer being considered for recommended practice? |
@Paper-Folding you are doing something wrong. |
@OrangeDog, I updated the links and the quoted text. It looks like the document has been reworked to further contextualize the constraints under which a JWT cookie can make sense. |
The OAuth 2.0 for Browser-Based Apps draft outlines the use of an HTTP-Only cookie to resolve the bearer token when the Application and API share a domain:
Spring Security might be able to simplify following this recommendation by introducing a cookie-based bearer token resolver. Additionally, the DSL could use that as a hint to leave CSRF enabled.
Related to #8668 (comment)
Given that encryption is part of this use case, #4435 likely should come before this ticket.
The text was updated successfully, but these errors were encountered: