Class: ActiveRecord::Jwt::DecoderConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-jwt/decoder_configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDecoderConfiguration

Returns a new instance of DecoderConfiguration.



5
6
7
8
9
10
11
12
13
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 5

def initialize
  self.sub       = :id
  self.algorithm = 'HS256'
  self.class     = true
  self.exp       = true
  self.iss       = 'issuer'
  self.aud       = 'audience'
  self.iat       = true
end

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def algorithm
  @algorithm
end

#audObject

Returns the value of attribute aud.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def aud
  @aud
end

#classObject

Returns the value of attribute class.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def class
  @class
end

#expObject

Returns the value of attribute exp.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def exp
  @exp
end

#iatObject

Returns the value of attribute iat.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def iat
  @iat
end

#issObject

Returns the value of attribute iss.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def iss
  @iss
end

#keyObject

Returns the value of attribute key.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def key
  @key
end

#subObject

Returns the value of attribute sub.



3
4
5
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 3

def sub
  @sub
end

Instance Method Details

#optionsObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/activerecord-jwt/decoder_configuration.rb', line 15

def options
  {
    algorithm:         self.algorithm,
    verify_expiration: self.exp.present?,
    verify_iss:        self.iss.present?,
    verify_aud:        self.aud.present?,
    verify_iat:        self.iat.present?,
    'iss' => self.iss,
    'aud' => self.aud
  }
end