-
Notifications
You must be signed in to change notification settings - Fork 25
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
Make scope
optional in token request for client_credentials
#71
Comments
Hey, According to RFC 6749, Section 3.3:
Omejdn's documentation specifies that
The syntax error is of course a bug :) Thanks for spotting it. The input validation will soon be improved. Now onto the design space of OAuth:
If you do need default scopes in your usecase, then here are two plugins (untested) for Omejdn which you can deploy according to the documentation. Solution 1: Global default scopeThis plugin reads the plugin configuration to determine a set of default scopes class ConfigDefaultScopesPlugin
def apply_default(bind)
params = bind.eval("params")
if params[:scope].nil? || params[:scope].empty?
params[:scope] = PluginLoader.configuration('config_default_scopes').join(' ')
end
end
PluginLoader.register 'TOKEN_STARTED', method(:apply_default)
end Save it as plugins:
config_default_scopes:
- default_scope_1
- default_scope_2 Solution 2: Per-Client default scopeThis plugin looks at the client metadata claim class ClientDefaultScopesPlugin
def apply_default(bind)
params = bind.eval("params")
client = bind.local_variable_get(:client)
if (params[:scope].nil? || params[:scope].empty?) && client.metadata.key?('default_scope')
params[:scope] = [*client.metadata['default_scope']].join(' ')
end
end
PluginLoader.register 'TOKEN_STARTED', method(:apply_default)
end Save it as plugins:
client_default_scopes: Of course, you can always customize these plugins to your needs. |
Currently the
scope
parameter is mandatory in the/token
endpoint, if not passed a "access_denied" is returned.Anyway, according to the OAuth2 client_credentials access token documentation that parameter is optional.
I also noticed that passing an empty
scope
causes aSyntaxError
The text was updated successfully, but these errors were encountered: