Class: Doorkeeper::OAuth::Helpers::ScopeChecker::Validator
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::Helpers::ScopeChecker::Validator
- Defined in:
- lib/doorkeeper/oauth/helpers/scope_checker.rb
Instance Attribute Summary collapse
-
#parsed_scopes ⇒ Object
readonly
Returns the value of attribute parsed_scopes.
-
#scope_str ⇒ Object
readonly
Returns the value of attribute scope_str.
Instance Method Summary collapse
-
#initialize(scope_str, server_scopes, app_scopes, grant_type) ⇒ Validator
constructor
A new instance of Validator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(scope_str, server_scopes, app_scopes, grant_type) ⇒ Validator
Returns a new instance of Validator.
10 11 12 13 14 15 16 |
# File 'lib/doorkeeper/oauth/helpers/scope_checker.rb', line 10 def initialize(scope_str, server_scopes, app_scopes, grant_type) @parsed_scopes = OAuth::Scopes.from_string(scope_str) @scope_str = scope_str @valid_scopes = valid_scopes(server_scopes, app_scopes) @scopes_by_grant_type = Doorkeeper.config.scopes_by_grant_type[grant_type.to_sym] if grant_type end |
Instance Attribute Details
#parsed_scopes ⇒ Object (readonly)
Returns the value of attribute parsed_scopes.
8 9 10 |
# File 'lib/doorkeeper/oauth/helpers/scope_checker.rb', line 8 def parsed_scopes @parsed_scopes end |
#scope_str ⇒ Object (readonly)
Returns the value of attribute scope_str.
8 9 10 |
# File 'lib/doorkeeper/oauth/helpers/scope_checker.rb', line 8 def scope_str @scope_str end |
Instance Method Details
#valid? ⇒ Boolean
18 19 20 21 22 23 |
# File 'lib/doorkeeper/oauth/helpers/scope_checker.rb', line 18 def valid? scope_str.present? && scope_str !~ /[\n\r\t]/ && @valid_scopes.has_scopes?(parsed_scopes) && permitted_to_grant_type? end |