module AuthStrategist::StrategyInterface

Public Class Methods

included(base) click to toggle source
# File lib/auth_strategist/strategy_interface.rb, line 5
def self.included(base)
  base.class_eval do
    extend Dry::Initializer
  end

  def base.define_components(*components)
    components.each do |component|
      option component, optional: true
    end
  end

  def base.components
    dry_initializer.definitions.keys
  end
end

Public Instance Methods

authorize!() click to toggle source
# File lib/auth_strategist/strategy_interface.rb, line 28
def authorize!
  raise unauthorized unless authorized?
end
authorized?() click to toggle source
# File lib/auth_strategist/strategy_interface.rb, line 21
def authorized?
  raise(
    AuthStrategist::Errors::AuthorizedNotImplemented,
    "#{self.class}#authorized? was not implemented."
  )
end
unauthorized() click to toggle source
# File lib/auth_strategist/strategy_interface.rb, line 32
def unauthorized
  AuthStrategist::Errors::Unauthorized
end