Module: Oauth2Provider
- Defined in:
- app/models/oauth2_provider/client.rb,
lib/oauth2_provider.rb,
lib/oauth2_provider/engine.rb,
app/models/oauth2_provider/scope.rb,
app/models/oauth2_provider/document.rb,
lib/oauth2_provider/controller_mixin.rb,
app/models/oauth2_provider/oauth_token.rb,
app/models/oauth2_provider/oauth_access.rb,
app/helpers/oauth2_provider/application_helper.rb,
app/models/oauth2_provider/oauth_authorization.rb,
app/models/oauth2_provider/oauth_daily_request.rb,
app/models/oauth2_provider/oauth_refresh_token.rb,
app/controllers/oauth2_provider/clients_controller.rb,
app/controllers/oauth2_provider/application_controller.rb
Overview
Daily requests of a Resource Owner on a specific client
Defined Under Namespace
Modules: ApplicationHelper, ControllerMixin, Document Classes: AccessesController, ApplicationController, AuthorizeController, Client, ClientsController, Engine, OauthAccess, OauthAuthorization, OauthDailyRequest, OauthRefreshToken, OauthToken, Scope, ScopesController, TokenController
Class Method Summary collapse
-
.clean(scope) ⇒ Object
Remove ‘no action’ keys.
- .normalize_scope(scope = []) ⇒ Object
- .settings ⇒ Object
Class Method Details
.clean(scope) ⇒ Object
Remove ‘no action’ keys. For example during normalization we add keys like ‘pizza’ (resource names) or ‘pizza/read’ wihch we have to remove to easily make the access recognition with the bearer token.
NOTE: at the moment are not allowed methods which contain the word “read” because it will be removed
32 33 34 35 36 37 |
# File 'lib/oauth2_provider.rb', line 32 def self.clean(scope) scope = scope.keep_if {|scope| scope =~ /\// } scope = scope.delete_if {|scope| scope =~ /read/ } scope = scope.uniq return scope end |
.normalize_scope(scope = []) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/oauth2_provider.rb', line 13 def self.normalize_scope(scope = []) scope = scope.split(" ") if scope.kind_of? String normalized = self::Scope.any_in(name: scope) normalized = normalized.map(&:values).flatten if normalized.empty? return self.clean(scope) else return self.clean(scope) + self.normalize_scope(normalized) end end |
.settings ⇒ Object
9 10 11 |
# File 'lib/oauth2_provider.rb', line 9 def self.settings @settings ||= YAML.load_file("#{Oauth2Provider::Engine.root}/config/oauth.yml") end |