Sha256: 00f4cb3792a2fac67c17a803e7a1b847c4e9a8d7bd36c475ad8422cbe0f61c8f

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

begin
  gem "omniauth", ">= 1.0.0"

  require "omniauth"
rescue LoadError
  warn "Could not load 'omniauth'. Please ensure you have the omniauth gem >= 1.0.0 installed and listed in your Gemfile."
  raise
end

# Clean up the default path_prefix. It will be automatically set by Kingsman.
OmniAuth.config.path_prefix = nil

OmniAuth.config.on_failure = Proc.new do |env|
  env['kingsman.mapping'] = Kingsman::Mapping.find_by_path!(env['PATH_INFO'], :path)
  controller_name  = ActiveSupport::Inflector.camelize(env['kingsman.mapping'].controllers[:omniauth_callbacks])
  controller_klass = ActiveSupport::Inflector.constantize("#{controller_name}Controller")
  controller_klass.action(:failure).call(env)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kingsman-0.1.1 lib/kingsman/omniauth.rb
kingsman-0.1.0 lib/kingsman/omniauth.rb