Class: Ksef::Auth::TokenInfo
- Inherits:
-
Data
- Object
- Data
- Ksef::Auth::TokenInfo
- Defined in:
- lib/ksef/auth/token_info.rb,
lib/ksef/auth/token_info.rb
Overview
Reopened rather than using a Data.define block so REDACTED lands on the class.
Constant Summary collapse
- REDACTED =
"[REDACTED]"
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#valid_until ⇒ Object
readonly
Returns the value of attribute valid_until.
Class Method Summary collapse
Instance Method Summary collapse
- #expired?(now = Time.now) ⇒ Boolean
- #inspect ⇒ Object
-
#to_s ⇒ Object
Both redacted, and
#to_sdeliberately so: these are bearer credentials, and returning the raw JWT here would make"...#{token_info}"in any log line leak a live one (DESIGN.md §4.5).
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token
6 7 8 |
# File 'lib/ksef/auth/token_info.rb', line 6 def token @token end |
#valid_until ⇒ Object (readonly)
Returns the value of attribute valid_until
6 7 8 |
# File 'lib/ksef/auth/token_info.rb', line 6 def valid_until @valid_until end |
Class Method Details
Instance Method Details
#expired?(now = Time.now) ⇒ Boolean
18 |
# File 'lib/ksef/auth/token_info.rb', line 18 def expired?(now = Time.now) = !valid_until.nil? && valid_until <= now |
#inspect ⇒ Object
24 |
# File 'lib/ksef/auth/token_info.rb', line 24 def inspect = "#<data Ksef::Auth::TokenInfo token=#{REDACTED} valid_until=#{valid_until.inspect}>" |
#to_s ⇒ Object
Both redacted, and #to_s deliberately so: these are bearer credentials, and
returning the raw JWT here would make "...#{token_info}" in any log line leak a
live one (DESIGN.md §4.5). Reaching for the value is an explicit #token call.
23 |
# File 'lib/ksef/auth/token_info.rb', line 23 def to_s = REDACTED |