Skip to content

Commit

Permalink
Merge pull request #153 from sealink/master
Browse files Browse the repository at this point in the history
Update password_access_token_request.rb to match method parameters in doorkeeper 5.5
  • Loading branch information
nbulaj authored Sep 3, 2021
2 parents 120501c + 20c871b commit 383dd02
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
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

0 comments on commit 383dd02

Please sign in to comment.