Skip to content

Commit 3074ad2

Browse files
committed
Do not run Doorkeper's authorization method if oauth2 scope is set to 'false'. Particularily useful when using WineBouncer in the grape-swagger for hiding certain endpoints for different kind of users. In this case oauth2 'false' is set on the GET swagger_doc endpoint making the doorkeeper_access_token available further in the process of building API endpoints.
1 parent bc8324e commit 3074ad2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/wine_bouncer/oauth2.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def before
8989
context.protected_endpoint = endpoint_protected?
9090
return unless context.protected_endpoint?
9191
self.doorkeeper_request = env # set request for later use.
92-
doorkeeper_authorize!(*auth_scopes)
92+
scopes = auth_scopes
93+
doorkeeper_authorize!(*scopes) unless scopes.include? :false
9394
context.doorkeeper_access_token = doorkeeper_token
9495
end
9596

0 commit comments

Comments
 (0)