Class: Omniauth::Rails::AuthorizationChecker
- Inherits:
-
Object
- Object
- Omniauth::Rails::AuthorizationChecker
- Defined in:
- app/models/omniauth/rails/authorization_checker.rb
Constant Summary collapse
- AUTHORIZATION_TYPES =
{ domains: AuthorizationTypes::Domains, emails: AuthorizationTypes::Emails, regex: AuthorizationTypes::Regex, }.freeze
Instance Method Summary collapse
- #authorized? ⇒ Boolean
-
#initialize(email:, params:) ⇒ AuthorizationChecker
constructor
A new instance of AuthorizationChecker.
Constructor Details
#initialize(email:, params:) ⇒ AuthorizationChecker
Returns a new instance of AuthorizationChecker.
11 12 13 14 |
# File 'app/models/omniauth/rails/authorization_checker.rb', line 11 def initialize(email:, params:) @email = email @params = params end |
Instance Method Details
#authorized? ⇒ Boolean
16 17 18 19 20 21 |
# File 'app/models/omniauth/rails/authorization_checker.rb', line 16 def params.map do |key, value| raise "Invalid key for authorization constraint" unless AUTHORIZATION_TYPES.key?(key) AUTHORIZATION_TYPES[key].new(email: email, value: value). end.all? end |