Class: NebulaToken::IssueResult

Inherits:
Object
  • Object
show all
Defined in:
lib/nebula_token.rb

Overview

Result of Engine#issue. Every timestamp is integer unix seconds ([N-2]).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, user_id:, family_id:, generation:, expires_at:, idle_expires_at:) ⇒ IssueResult

Returns a new instance of IssueResult.



536
537
538
539
540
541
542
543
544
# File 'lib/nebula_token.rb', line 536

def initialize(token:, user_id:, family_id:, generation:, expires_at:, idle_expires_at:)
  @token = token
  @user_id = user_id
  @family_id = family_id
  @generation = generation
  @expires_at = expires_at
  @idle_expires_at = idle_expires_at
  freeze
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



534
535
536
# File 'lib/nebula_token.rb', line 534

def expires_at
  @expires_at
end

#family_idObject (readonly)

Returns the value of attribute family_id.



534
535
536
# File 'lib/nebula_token.rb', line 534

def family_id
  @family_id
end

#generationObject (readonly)

Returns the value of attribute generation.



534
535
536
# File 'lib/nebula_token.rb', line 534

def generation
  @generation
end

#idle_expires_atObject (readonly)

Returns the value of attribute idle_expires_at.



534
535
536
# File 'lib/nebula_token.rb', line 534

def idle_expires_at
  @idle_expires_at
end

#tokenObject (readonly)

Returns the value of attribute token.



534
535
536
# File 'lib/nebula_token.rb', line 534

def token
  @token
end

#user_idObject (readonly)

Returns the value of attribute user_id.



534
535
536
# File 'lib/nebula_token.rb', line 534

def user_id
  @user_id
end

Instance Method Details

#inspectObject Also known as: to_s

[N-14]: the token embeds the raw verifier, so it must never reach a debug representation — p issued or "#{issued}" in a controller would otherwise write a live credential into the log.



549
550
551
552
553
# File 'lib/nebula_token.rb', line 549

def inspect
  "#<NebulaToken::IssueResult token=[REDACTED] user_id=#{@user_id.inspect} " \
    "family_id=#{@family_id.inspect} generation=#{@generation} " \
    "expires_at=#{@expires_at} idle_expires_at=#{@idle_expires_at}>"
end