Class: RailsIam::Config::Jwt

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_iam/config/jwt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJwt

Returns a new instance of Jwt.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rails_iam/config/jwt.rb', line 12

def initialize
  # Secret verification string used to sign security tokens.
  @secret = ENV["JWT_SECRET"].presence || Rails.application&.secret_key_base

  # Digital signature algorithm category mapping.
  @algorithm = "HS256"
  @jwt_expires_in = 15.minutes

  # Optional security claim validations (RFC 7519 standard targets).
  # Leave nil to disable strict validation checks.
  @issuer = nil
  @audience = nil
end

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



6
7
8
# File 'lib/rails_iam/config/jwt.rb', line 6

def algorithm
  @algorithm
end

#audienceObject

Returns the value of attribute audience.



6
7
8
# File 'lib/rails_iam/config/jwt.rb', line 6

def audience
  @audience
end

#issuerObject

Returns the value of attribute issuer.



6
7
8
# File 'lib/rails_iam/config/jwt.rb', line 6

def issuer
  @issuer
end

#jwt_expires_inObject

Returns the value of attribute jwt_expires_in.



6
7
8
# File 'lib/rails_iam/config/jwt.rb', line 6

def jwt_expires_in
  @jwt_expires_in
end

#secretObject

Returns the value of attribute secret.



6
7
8
# File 'lib/rails_iam/config/jwt.rb', line 6

def secret
  @secret
end