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.



497
498
499
500
501
502
503
504
505
# File 'lib/nebula_token.rb', line 497

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.



495
496
497
# File 'lib/nebula_token.rb', line 495

def expires_at
  @expires_at
end

#family_idObject (readonly)

Returns the value of attribute family_id.



495
496
497
# File 'lib/nebula_token.rb', line 495

def family_id
  @family_id
end

#generationObject (readonly)

Returns the value of attribute generation.



495
496
497
# File 'lib/nebula_token.rb', line 495

def generation
  @generation
end

#idle_expires_atObject (readonly)

Returns the value of attribute idle_expires_at.



495
496
497
# File 'lib/nebula_token.rb', line 495

def idle_expires_at
  @idle_expires_at
end

#tokenObject (readonly)

Returns the value of attribute token.



495
496
497
# File 'lib/nebula_token.rb', line 495

def token
  @token
end

#user_idObject (readonly)

Returns the value of attribute user_id.



495
496
497
# File 'lib/nebula_token.rb', line 495

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.



510
511
512
513
514
# File 'lib/nebula_token.rb', line 510

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