-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Support processing parameters sent as a URL-encoded form #8325
Conversation
The approach taken is intended to be conservative since we've always assumed JSON and not required Content-Type. Tools and libraries that default to "application/x-www-form-urlencoded" even when JSON is being sent (e.g. curl) will break without these extra backwards compatibility measures. This PR is a reboot of: #5935
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.
Looks great!
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.
👍 nice!
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.
Looks good modulo one potential bug.
form_post is not a commonly used mode but is needed for certain applications. Adding support for it impacted both the CLI and UI handler, as well as Vault (hashicorp/vault#8325). In addition to allowing configuration of `response_mode=form_post`, the operator can now also choose to configure `response_types`, which today is always `code`. This PR allows adding the `id_token` type as well. This is only supported if form_post is enabled. A curious aspect of this PR is to respond with some Javascript that writes to localStorage. This is a effectively doing what the UI does after a redirect, and allows the form_post support without modifying the UI code at all. There are cleaner options, but they would require a significant update to the UI.
* Support form_post mode form_post is not a commonly used mode but is needed for certain applications. Adding support for it impacted both the CLI and UI handler, as well as Vault (hashicorp/vault#8325). In addition to allowing configuration of `response_mode=form_post`, the operator can now also choose to configure `response_types`, which today is always `code`. This PR allows adding the `id_token` type as well. This is only supported if form_post is enabled. A curious aspect of this PR is to respond with some Javascript that writes to localStorage. This is a effectively doing what the UI does after a redirect, and allows the form_post support without modifying the UI code at all. There are cleaner options, but they would require a significant update to the UI.
The approach taken is intended to be conservative since we've always
assumed JSON and not required Content-Type. Tools and libraries that
default to "application/x-www-form-urlencoded" even when JSON is being
sent (e.g. curl) will break without these extra backwards compatibility
measures.
This PR is a reboot of: #5935