Module: PublishingPlatform::SSO::Config

Defined in:
lib/publishing_platform_sso/config.rb

Constant Summary collapse

@@user_model =
"User"
@@oauth_id =
ENV.fetch("PUBLISHING_PLATFORM_SSO_OAUTH_ID", "test-oauth-id")
@@oauth_secret =
ENV.fetch("PUBLISHING_PLATFORM_SSO_OAUTH_SECRET", "test-oauth-secret")
@@oauth_root_url =
PublishingPlatformLocation.find("signon")
@@auth_valid_for =
20 * 3600
@@intercept_401_responses =
true
@@connection_opts =
{
  request: {
    open_timeout: 5,
  },
}

Class Method Summary collapse

Class Method Details

.permissions_for_dummy_api_userObject



44
45
46
# File 'lib/publishing_platform_sso/config.rb', line 44

def self.permissions_for_dummy_api_user
  %w[signin].push(*additional_mock_permissions_required)
end

.use_mock_strategies?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
60
# File 'lib/publishing_platform_sso/config.rb', line 52

def self.use_mock_strategies?
  default_strategy = if %w[development test].include?(Rails.env)
                       "mock"
                     else
                       "real"
                     end

  ENV.fetch("PUBLISHING_PLATFORM_SSO_STRATEGY", default_strategy) == "mock"
end

.user_klassObject



48
49
50
# File 'lib/publishing_platform_sso/config.rb', line 48

def self.user_klass
  user_model.to_s.constantize
end