Sha256: e5deb2a52d4421b278a5f996b7b666215e0938708fcc88bf39317235928aa313
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require 'rails' require 'gds-sso/config' require 'gds-sso/omniauth_strategy' require 'gds-sso/warden_config' module GDS module SSO autoload :FailureApp, 'gds-sso/failure_app' autoload :ControllerMethods, 'gds-sso/controller_methods' autoload :User, 'gds-sso/user' autoload :ApiAccess, 'gds-sso/api_access' # User to return as logged in during tests mattr_accessor :test_user def self.config yield GDS::SSO::Config end class Engine < ::Rails::Engine # Force routes to be loaded if we are doing any eager load. # TODO - check this one - Stolen from Devise because it looked sensible... config.before_eager_load { |app| app.reload_routes! } config.app_middleware.use ::OmniAuth::Builder do provider :gds, GDS::SSO::Config.oauth_id, GDS::SSO::Config.oauth_secret end def self.use_mock_strategies? ['development', 'test'].include?(Rails.env) && ENV['GDS_SSO_STRATEGY'] != 'real' end def self.default_strategies use_mock_strategies? ? [:mock_gds_sso, :mock_gds_sso_api_access] : [:gds_sso, :gds_sso_api_access] end puts "Loading Warden!" config.app_middleware.use Warden::Manager do |config| config.default_strategies *self.default_strategies config.failure_app = GDS::SSO::FailureApp end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gds-sso-0.5.1 | lib/gds-sso.rb |
gds-sso-0.5.0 | lib/gds-sso.rb |