Class: HasHelpers::ServiceTrust::Configuration
- Inherits:
-
Object
- Object
- HasHelpers::ServiceTrust::Configuration
- Defined in:
- lib/has_helpers/service_trust/configuration.rb
Instance Attribute Summary collapse
-
#audit_async ⇒ Object
Returns the value of attribute audit_async.
-
#audit_log_retention ⇒ Object
Returns the value of attribute audit_log_retention.
-
#clock_skew ⇒ Object
Returns the value of attribute clock_skew.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#issuer ⇒ Object
Returns the value of attribute issuer.
-
#jwks_cache_ttl ⇒ Object
Returns the value of attribute jwks_cache_ttl.
-
#jwks_stale_ttl ⇒ Object
Returns the value of attribute jwks_stale_ttl.
-
#key_environment_env ⇒ Object
Returns the value of attribute key_environment_env.
-
#kid_env ⇒ Object
Returns the value of attribute kid_env.
-
#max_token_ttl ⇒ Object
Returns the value of attribute max_token_ttl.
-
#private_key_env ⇒ Object
Returns the value of attribute private_key_env.
-
#rate_limit_per_issuer ⇒ Object
Returns the value of attribute rate_limit_per_issuer.
-
#replay_cache_redis ⇒ Object
Returns the value of attribute replay_cache_redis.
-
#token_ttl ⇒ Object
Returns the value of attribute token_ttl.
Instance Method Summary collapse
- #env ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #trusted?(issuer_name) ⇒ Boolean
- #trusted_issuer(issuer_name) ⇒ Object
- #trusted_issuers(&block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 23 def initialize @issuer = nil @environment = defined?(Rails) ? Rails.env : "development" @private_key_env = "SERVICE_TRUST_PRIVATE_KEY" @kid_env = "SERVICE_TRUST_KEY_ID" @key_environment_env = "SERVICE_TRUST_KEY_ENVIRONMENT" @token_ttl = 60.seconds @max_token_ttl = 5.minutes @clock_skew = 30.seconds @trusted_issuer_block = nil @replay_cache_redis = -> { RedisConf.current } @rate_limit_per_issuer = { requests: 100, per: 1.minute } @audit_log_retention = 30.days @audit_async = false @jwks_cache_ttl = 1.hour @jwks_stale_ttl = 5.minutes end |
Instance Attribute Details
#audit_async ⇒ Object
Returns the value of attribute audit_async.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def audit_async @audit_async end |
#audit_log_retention ⇒ Object
Returns the value of attribute audit_log_retention.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def audit_log_retention @audit_log_retention end |
#clock_skew ⇒ Object
Returns the value of attribute clock_skew.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def clock_skew @clock_skew end |
#environment ⇒ Object
Returns the value of attribute environment.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def environment @environment end |
#issuer ⇒ Object
Returns the value of attribute issuer.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def issuer @issuer end |
#jwks_cache_ttl ⇒ Object
Returns the value of attribute jwks_cache_ttl.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def jwks_cache_ttl @jwks_cache_ttl end |
#jwks_stale_ttl ⇒ Object
Returns the value of attribute jwks_stale_ttl.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def jwks_stale_ttl @jwks_stale_ttl end |
#key_environment_env ⇒ Object
Returns the value of attribute key_environment_env.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def key_environment_env @key_environment_env end |
#kid_env ⇒ Object
Returns the value of attribute kid_env.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def kid_env @kid_env end |
#max_token_ttl ⇒ Object
Returns the value of attribute max_token_ttl.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def max_token_ttl @max_token_ttl end |
#private_key_env ⇒ Object
Returns the value of attribute private_key_env.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def private_key_env @private_key_env end |
#rate_limit_per_issuer ⇒ Object
Returns the value of attribute rate_limit_per_issuer.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def rate_limit_per_issuer @rate_limit_per_issuer end |
#replay_cache_redis ⇒ Object
Returns the value of attribute replay_cache_redis.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def replay_cache_redis @replay_cache_redis end |
#token_ttl ⇒ Object
Returns the value of attribute token_ttl.
8 9 10 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 8 def token_ttl @token_ttl end |
Instance Method Details
#env ⇒ Object
54 55 56 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 54 def env environment.respond_to?(:to_sym) && defined?(ActiveSupport::StringInquirer) ? ActiveSupport::StringInquirer.new(environment.to_s) : environment end |
#trusted?(issuer_name) ⇒ Boolean
46 47 48 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 46 def trusted?(issuer_name) trusted_issuer(issuer_name).present? end |
#trusted_issuer(issuer_name) ⇒ Object
50 51 52 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 50 def trusted_issuer(issuer_name) resolved_trusted_issuers[issuer_name.to_s] end |
#trusted_issuers(&block) ⇒ Object
41 42 43 44 |
# File 'lib/has_helpers/service_trust/configuration.rb', line 41 def trusted_issuers(&block) @trusted_issuer_block = block if block resolved_trusted_issuers end |