8000 Update HTTP headers by boimw · Pull Request #1644 · doorkeeper-gem/doorkeeper · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update HTTP headers #1644

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

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ User-visible changes worth mentioning.
## main

- [#ID] Add your PR description here.
- [#1644] Update HTTP headers.

# 5.6.5

Expand Down Expand Up @@ -45,7 +46,7 @@ User-visible changes worth mentioning.

## 5.6.0.rc2

- [#1558] Fixed bug: able to obtain a token with default scopes even if they are not present in the
- [#1558] Fixed bug: able to obtain a token with default scopes even if they are not present in the
application scopes when using client credentials.
- [#1567] Only filter `code` parameter if authorization_code grant flow is enabled.

Expand Down Expand Up @@ -80,7 +81,7 @@ User-visible changes worth mentioning.
## 5.5.1

- [#1496] Revoke `old_refresh_token` if `previous_refresh_token` is present.
- [#1495] Fix `respond_to` undefined in API-only mode
- [#1495] Fix `respond_to` undefined in API-only mode
- [#1488] Verify client authentication for Resource Owner Password Grant when
`config.skip_client_authentication_for_password_grant` is set and the client credentials
are sent in a HTTP Basic auth header.
Expand All @@ -94,10 +95,10 @@ User-visible changes worth mentioning.
## 5.5.0.rc2

- [#1473] Enable `Applications` and `AuthorizedApplications` controllers in API mode.
**[IMPORTANT]** you can still skip these controllers using `skip_controllers` in

**[IMPORTANT]** you can still skip these controllers using `skip_controllers` in
`use_doorkeeper` inside `routes.rb`. Please do it in case you don't need them.

- [#1472] Fix `establish_connection` configuration for custom defined models.
- [#1471] Add support for Ruby 3.0.
- [#1469] Check if `redirect_uri` exists.
Expand Down
3 changes: 1 addition & 2 deletions lib/doorkeeper/oauth/error_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def redirect_uri

def headers
{
"Cache-Control" => "no-store",
"Pragma" => "no-cache",
"Cache-Control" => "no-store, no-cache",
"Content-Type" => "application/json; charset=utf-8",
"WWW-Authenticate" => authenticate_info,
}
Expand Down
3 changes: 1 addition & 2 deletions lib/doorkeeper/oauth/token_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def status

def headers
{
"Cache-Control" => "no-store",
"Pragma" => "no-cache",
"Cache-Control" => "no-store, no-cache",
"Content-Type" => "application/json; charset=utf-8",
}
end
Expand Down
3 changes: 1 addition & 2 deletions spec/lib/oauth/token_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

it "includes access token response headers" do
headers = response.headers
expect(headers.fetch("Cache-Control")).to eq("no-store")
expect(headers.fetch("Pragma")).to eq("no-cache")
expect(headers.fetch("Cache-Control")).to eq("no-store, no-cache")
end

it "status is ok" do
Expand Down
3 changes: 1 addition & 2 deletions spec/requests/endpoints/token_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
it "respond with correct headers" do
post token_endpoint_url(code: @authorization.token, client: @client)

expect(headers["Pragma"]).to eq("no-cache")
expect(headers["Cache-Control"]).to be_in(["no-store", "private, no-store"])
expect(headers["Cache-Control"]).to be_in(["no-store", "no-cache, no-store", "private, no-store"])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit late here but, given that Pragma: no-cache is always present here, would the equivalent not be:

    expect(headers["Cache-Control"]).to be_in(["no-store, no-cache", "private, no-store, no-cache"])

expect(headers["Content-Type"]).to eq("application/json; charset=utf-8")
end

Expand Down
0