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

Yield application to allow_grant_flow_for_client? client credentials … #1400

Merged
merged 1 commit into from
Apr 15, 2020
Merged

Yield application to allow_grant_flow_for_client? client credentials … #1400

merged 1 commit into from
Apr 15, 2020

Conversation

aclemons
Copy link
Contributor

…validation

Closes #1398

@nbulaj
Copy link
Member

nbulaj commented Apr 15, 2020

Something wrong with the specs.

UPD: see above comment

We had a case in the past when hooks could have Application instance or Doorkeeper::OAuth::Client, so maybe it makes sense to use this approach too

Maybe this one or somewhere else:

oauth_client = if pre_auth_or_oauth_client.respond_to?(:application)
pre_auth_or_oauth_client.application
elsif pre_auth_or_oauth_client.respond_to?(:client)
pre_auth_or_oauth_client.client
else
pre_auth_or_oauth_client
end

@nbulaj
Copy link
Member

nbulaj commented Apr 15, 2020

Ah, OK, I've checked ./spec/lib/oauth/client_credentials_integration_spec.rb:11 and seems like it's incorrect.

You could just replace the let with:

let(:client) { Doorkeeper::OAuth::Client.new(FactoryBot.build_stubbed :application) }

And spec must pass

@@ -6,7 +6,7 @@
let(:server) { Doorkeeper.configuration }

context "with a valid request" do
let(:client) { FactoryBot.create :application }
let(:client) { Doorkeeper::OAuth::Client.new(FactoryBot.build_stubbed :application) }

Choose a reason for hiding this comment

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

Style/NestedParenthesizedCalls: Add parentheses to nested method call FactoryBot.build_stubbed :application.

@aclemons
Copy link
Contributor Author

Resolved the changelog merge conflict and updated the integration spec now.

Copy link
Member

@nbulaj nbulaj left a comment

Choose a reason for hiding this comment

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

🚝

@nbulaj nbulaj merged commit ec9e7ea into doorkeeper-gem:master Apr 15, 2020
@nbulaj
Copy link
Member

nbulaj commented Apr 15, 2020

Thanks @aclemons !

@aclemons aclemons deleted the client_credentials_validation branch April 15, 2020 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

client yielded to allow_grant_flow_for_client config can either be a client or an application object
3 participants