Class: Tzispa::Helpers::Security::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/tzispa/helpers/security.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, secret) ⇒ Identity



62
63
64
65
# File 'lib/tzispa/helpers/security.rb', line 62

def initialize(id, secret)
  @id = id
  @token = generate_token id, secret
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



60
61
62
# File 'lib/tzispa/helpers/security.rb', line 60

def id
  @id
end

#tokenObject (readonly)

Returns the value of attribute token.



60
61
62
# File 'lib/tzispa/helpers/security.rb', line 60

def token
  @token
end

Instance Method Details

#valid?(secret) ⇒ Boolean



67
68
69
# File 'lib/tzispa/helpers/security.rb', line 67

def valid?(secret)
  @token == Identity.generate_token(@id, secret)
end