-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 option to authorize the calling user to access an Application #1354
Add option to authorize the calling user to access an Application #1354
Conversation
b34d790
to
93d0857
Compare
e8d1b0d
to
d120c92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, have little time to watch the PR. Thanks for the proposal, we need to do some work and then we can merge <3
d120c92
to
dcd7c1b
Compare
dcd7c1b
to
65934c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do some renaming and LGTM for me 🚝
Thanks for your work!
@@ -7,6 +7,7 @@ class PreAuthorization | |||
|
|||
validate :client_id, error: :invalid_request | |||
validate :client, error: :invalid_client | |||
validate :access_to_client, error: :invalid_client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And considering comment about the option name let rename it to resource_owner_authorized_for_client
. Don't get angst about the long naming just because I think it must be explicit rather than implicit.
@@ -17,7 +18,7 @@ class PreAuthorization | |||
attr_reader :server, :client_id, :client, :redirect_uri, :response_type, :state, | |||
:code_challenge, :code_challenge_method, :missing_param | |||
|
|||
def initialize(server, attrs = {}) | |||
def initialize(server, attrs = {}, resource_owner = nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK for me just because attrs
not options, so we can add one more argument
@@ -26,6 +27,7 @@ def initialize(server, attrs = {}) | |||
@state = attrs[:state] | |||
@code_challenge = attrs[:code_challenge] | |||
@code_challenge_method = attrs[:code_challenge_method] | |||
@resource_owner = resource_owner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add it also to attr_readers, maybe we wanna to access it in the future for some reason
…ion during pre-auth
65934c2
to
df87749
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Summary
I've added an option to define whether a user can authorize an application.
My specific use case is the following:
This is now achievable with the new option:
When this validation fails the
invalid_client
error is used so it's indistinguishable from a nonexistent Application