Sha256: 5a9bec5f58ea3ffc965219c113c67c76347acb18df3fb4033972883f5cc6e138
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require "nulogy_sso/engine" module NulogySSO # Config variables for the engine mattr_accessor :sso_config, :find_user_by_email, :handle_sso_error mattr_accessor :handle_unauthenticated_request, default: lambda { |controller| controller.redirect_to NulogySSO::Engine.routes.url_helpers.login_path, allow_other_host: true } # Public Constants JWT_EMAIL_KEY = "https://nulogy.net/email" def self.sso_config=(sso_config_hash) raise "sso_config must be a Hash" unless sso_config_hash.is_a? Hash missing_keys = REQUIRED_SSO_CONFIG_KEYS - sso_config_hash.symbolize_keys.keys if missing_keys.present? raise "Missing required sso_config keys ['#{missing_keys.join("', '")}']" end @@sso_config = SSOConfig.new(**sso_config_hash.symbolize_keys.slice(*REQUIRED_SSO_CONFIG_KEYS)) end REQUIRED_SSO_CONFIG_KEYS = %i[ audience base_uri client_id client_secret cookie_prefix login_uri redirect_uri ] private_constant :REQUIRED_SSO_CONFIG_KEYS SSOConfig = Struct.new(*REQUIRED_SSO_CONFIG_KEYS, keyword_init: true) def self.sso_cookie_key "#{sso_config.cookie_prefix}_access_token" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nulogy_sso-2.6.0 | lib/nulogy_sso.rb |
nulogy_sso-2.5.1 | lib/nulogy_sso.rb |