Skip to content
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

Update password_access_token_request.rb to match method parameters in doorkeeper 5.5 #153

Merged
merged 2 commits into from
Sep 3, 2021
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Unreleased

- [#153] Fix ArgumentError caused by client credential validation introduced in Doorkeeper 5.5.1

## v1.8.0 (2021-05-11)

No changes from v1.8.0-rc1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ module OAuth
module PasswordAccessTokenRequest
attr_reader :nonce

def initialize(server, client, resource_owner, parameters = {})
super
@nonce = parameters[:nonce]
if Gem.loaded_specs['doorkeeper'].version >= Gem::Version.create('5.5.1')
def initialize(server, client, credentials, resource_owner, parameters = {})
super
@nonce = parameters[:nonce]
end
else
def initialize(server, client, resource_owner, parameters = {})
super
@nonce = parameters[:nonce]
end
end

private
Expand Down
7 changes: 6 additions & 1 deletion spec/lib/oauth/password_access_token_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
require 'rails_helper'

describe Doorkeeper::OpenidConnect::OAuth::PasswordAccessTokenRequest do
subject { Doorkeeper::OAuth::PasswordAccessTokenRequest.new server, client, resource_owner, { nonce: '123456' } }
if Gem.loaded_specs['doorkeeper'].version >= Gem::Version.create('5.5.1')
subject { Doorkeeper::OAuth::PasswordAccessTokenRequest.new server, client, credentials, resource_owner, { nonce: '123456' } }
else
subject { Doorkeeper::OAuth::PasswordAccessTokenRequest.new server, client, resource_owner, { nonce: '123456' } }
end

let(:server) { double }
let(:client) { double }
let(:credentials) { }
let(:resource_owner) { create :user }
let(:token) { create :access_token }
let(:response) { Doorkeeper::OAuth::TokenResponse.new token }
Expand Down