class Apia::Authenticator

Public Class Methods

authorized_scope?(environment, scopes) click to toggle source

If any of the given scopes are valid

@param environment [Apia::RequestEnvironment] @param scope [String] @return [Boolean]

# File lib/apia/authenticator.rb, line 47
def authorized_scope?(environment, scopes)
  return true if definition.scope_validator.nil?
  return true if scopes.empty?

  scopes.any? { |s| environment.call(s, &definition.scope_validator) }
end
collate_objects(set) click to toggle source

Finds all objects referenced by this authenticator and add them to the provided set.

@param set [Apia::ObjectSet] @return [void]

# File lib/apia/authenticator.rb, line 28
def collate_objects(set)
  definition.potential_errors.each do |error|
    set.add_object(error)
  end
end
definition() click to toggle source

Return the definition for this authenticator

@return [Apia::Definitions::Authenticator]

# File lib/apia/authenticator.rb, line 19
def definition
  @definition ||= Definitions::Authenticator.new(Helpers.class_name_to_id(name))
end
execute(environment) click to toggle source

Execute this authenticator within the given environment

@param environment [Apia::RequestEnvironment] @return [void]

# File lib/apia/authenticator.rb, line 38
def execute(environment)
  new(environment).call
end