Sha256: 324446e421e8ba7f381c734fd0f128908945c756691d1ea0f635a30eab476ad5

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'pansophy_authenticator/version'

module PansophyAuthenticator
  def self.configure
    configurator = Configuration::Configurator.new
    yield configurator if block_given?
    @configuration = configurator.configuration
  end

  def self.configuration
    @configuration ||= configure
  end

  def self.valid_configuration
    fail Error, configuration.errors unless configuration.valid?
    configuration
  end

  def self.remote?
    configuration.remote?
  end

  def self.local?
    configuration.local?
  end

  def self.application
    configuration.application
  end

  def self.own_key
    ApplicationKeys.own
  end

  def self.authenticate!(application, key)
    ApplicationKeys.validate!(application, key)
  end

  def self.clear_cached_keys
    ApplicationKeys.clear_cache
  end

  %i(key valid?).each do |method|
    define_singleton_method(method) { |*args| ApplicationKeys.send(method, *args) }
  end

  Error = Class.new(StandardError)
end

require 'pansophy_authenticator/configuration'
require 'pansophy_authenticator/application_keys'
require 'pansophy_authenticator/matcher'
require 'pansophy_authenticator/local'
require 'pansophy_authenticator/remote'
require 'pansophy_authenticator/cache_stores/memory'
require 'pansophy_authenticator/cache'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pansophy_authenticator-0.5.0 lib/pansophy_authenticator.rb