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

Add resource indicators #1559

Closed

Conversation

danielcooper
Copy link

@danielcooper danielcooper commented Mar 2, 2022

Summary

Adds resource indicator support (#1413) as an optional extension.

Other Information

I've got a few implementation questions:

  1. Should this be an optional extension (with a migration to generate) or just added into the default setup in a disabled state? I'm not clear how best to test the apps when the new migration hasn't been run/generated?

  2. The way resource is specified in the RFC is quite inconvenient:

  GET /as/authorization.oauth2?response_type=code
     &client_id=s6BhdRkqt3
     &state=tNwzQ87pC6llebpmac_IDeeq-mCR2wLDYljHUZUAWuI
     &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb
     &scope=calendar%20contacts
     &resource=https%3A%2F%2Fcal.example.com%2F
     &resource=https%3A%2F%2Fcontacts.example.com%2F HTTP/1.1
  Host: authorization-server.example.com

Out of the box rails params won't work in this case. You can see I've hacked together a quick fix, do you have any thoughts on a better way of doing this? Maybe it'd be better to only support one resource.

app/controllers/doorkeeper/authorizations_controller.rb Outdated Show resolved Hide resolved
app/controllers/doorkeeper/authorizations_controller.rb Outdated Show resolved Hide resolved
app/controllers/doorkeeper/authorizations_controller.rb Outdated Show resolved Hide resolved
lib/doorkeeper/config.rb Outdated Show resolved Hide resolved
lib/doorkeeper/config.rb Outdated Show resolved Hide resolved

module Doorkeeper
module OAuth
class ResourceIndicators

Choose a reason for hiding this comment

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

Style/Documentation: Missing top-level class documentation comment.

lib/generators/doorkeeper/templates/initializer.rb Outdated Show resolved Hide resolved
spec/controllers/authorizations_controller_spec.rb Outdated Show resolved Hide resolved
spec/controllers/tokens_controller_spec.rb Outdated Show resolved Hide resolved

# generator_spec gem requires such block definition :(
#
# rubocop:disable Style/BlockDelimiters

Choose a reason for hiding this comment

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

Lint/MissingCopEnableDirective: Re-enable Style/BlockDelimiters cop with # rubocop:enable after disabling it.

@guardrails
Copy link

guardrails bot commented Mar 2, 2022

⚠️ We detected 1 security issue in this pull request:

Insecure Processing of Data (1)
Docs Details
💡 Title: Potential XSS (unquoted template variable), Severity: Medium
class AddResourceIndicatorsToAccessGrantsAndAccessTokens < ActiveRecord::Migration<%= migration_version %>

More info on how to fix Insecure Processing of Data in Ruby.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

@danielcooper danielcooper force-pushed the resouce_indicators branch 2 times, most recently from c600965 to d1f27a6 Compare March 7, 2022 14:58
@danielcooper danielcooper marked this pull request as ready for review March 7, 2022 16:00
@danielcooper danielcooper changed the title [DRAFT] Add resource indicators Add resource indicators Mar 14, 2022
Add resource indicators
Add support for refreshing a resource indicator
@nbulaj
Copy link
Member

nbulaj commented Apr 25, 2022

hey @danielcooper , great work 👍

Should this be an optional extension (with a migration to generate) or just added into the default setup in a disabled state? I'm not clear how best to test the apps when the new migration hasn't been run/generated?

Yep, I'm for keeping such functionality as an extension. The main idea is to not pollute core gem with everything, but try to make it more flexible and modular.

The way resource is specified in the RFC is quite inconvenient:

Hm, good question 🤔 I don't remember when I done something like this with a collection-like params in Rails. But something tells me there should be a god way of doing it

@danielcooper
Copy link
Author

@nbulaj Thanks for taking a look - what can I do to help get this merged?

@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 10, 2022
@stale stale bot closed this Jul 31, 2022
@danielcooper
Copy link
Author

@nbulaj Sorry to pester.

Are you generally not keen on this feature, the implementation, or is it just a matter of time to review?

@nbulaj
Copy link
Member

nbulaj commented Aug 8, 2022

Hey @danielcooper 👋

I love the feature for sure, I just wanted to have such features as a extensions (just like doorkeeper_openid_connect)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants