Class: SimpleJwtAuth::Claims

Inherits:
Object
  • Object
show all
Includes:
Traits::Configurable
Defined in:
lib/simple_jwt_auth/claims.rb

Instance Method Summary collapse

Constructor Details

#initializeClaims

Returns a new instance of Claims.



7
8
9
# File 'lib/simple_jwt_auth/claims.rb', line 7

def initialize
  @now = Time.now.to_i
end

Instance Method Details

#merge(other_hash) ⇒ Object



11
12
13
# File 'lib/simple_jwt_auth/claims.rb', line 11

def merge(other_hash)
  to_h.merge(other_hash)
end

#to_hObject



15
16
17
18
19
20
21
# File 'lib/simple_jwt_auth/claims.rb', line 15

def to_h
  {
    iat: @now,
    exp: @now + config.exp_seconds,
    iss: config.issuer
  }
end