Class: Aha::Auth::Configuration
- Inherits:
-
Object
- Object
- Aha::Auth::Configuration
- Defined in:
- lib/aha/auth/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
API key for server-to-server authentication.
-
#client_id ⇒ Object
Client/application identifier.
-
#jwks_cache_ttl ⇒ Object
How long to cache JWKS keys (default: 1 hour).
-
#refresh_threshold ⇒ Object
Number of seconds before token expiry to trigger refresh (default: 120).
-
#server_url ⇒ Object
The base URL of the BuilderCore auth server.
-
#timeout ⇒ Object
HTTP timeout in seconds (default: 30).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
24 25 26 27 28 29 30 31 |
# File 'lib/aha/auth/configuration.rb', line 24 def initialize @server_url = ENV.fetch("AHA_CORE_SERVER_URL", "https://secure.aha.io/api/core") @api_key = ENV.fetch("AHA_CORE_API_KEY", nil) @client_id = ENV.fetch("APPLICATION_ID", nil) @jwks_cache_ttl = 3600 # 1 hour @refresh_threshold = 120 # 2 minutes @timeout = 30 end |
Instance Attribute Details
#api_key ⇒ Object
API key for server-to-server authentication
10 11 12 |
# File 'lib/aha/auth/configuration.rb', line 10 def api_key @api_key end |
#client_id ⇒ Object
Client/application identifier
13 14 15 |
# File 'lib/aha/auth/configuration.rb', line 13 def client_id @client_id end |
#jwks_cache_ttl ⇒ Object
How long to cache JWKS keys (default: 1 hour)
16 17 18 |
# File 'lib/aha/auth/configuration.rb', line 16 def jwks_cache_ttl @jwks_cache_ttl end |
#refresh_threshold ⇒ Object
Number of seconds before token expiry to trigger refresh (default: 120)
19 20 21 |
# File 'lib/aha/auth/configuration.rb', line 19 def refresh_threshold @refresh_threshold end |
#server_url ⇒ Object
The base URL of the BuilderCore auth server
7 8 9 |
# File 'lib/aha/auth/configuration.rb', line 7 def server_url @server_url end |
#timeout ⇒ Object
HTTP timeout in seconds (default: 30)
22 23 24 |
# File 'lib/aha/auth/configuration.rb', line 22 def timeout @timeout end |
Instance Method Details
#validate! ⇒ Object
33 34 35 36 |
# File 'lib/aha/auth/configuration.rb', line 33 def validate! raise ConfigurationError, "server_url is required" if server_url.nil? || server_url.to_s.empty? raise ConfigurationError, "client_id is required" if client_id.nil? || client_id.to_s.empty? end |