Class: Minato::Rails::Auth::JWT::Configuration
- Inherits:
-
Object
- Object
- Minato::Rails::Auth::JWT::Configuration
- Defined in:
- lib/minato/rails/auth/jwt/configuration.rb
Instance Attribute Summary collapse
-
#additional_params ⇒ Object
Returns the value of attribute additional_params.
-
#algorithms ⇒ Object
Returns the value of attribute algorithms.
- #decode_params ⇒ Object
-
#hmac_secret ⇒ Object
Returns the value of attribute hmac_secret.
-
#issuer ⇒ Object
Returns the value of attribute issuer.
- #jwks ⇒ Object
-
#jwks_uri ⇒ Object
Returns the value of attribute jwks_uri.
-
#verify_iss ⇒ Object
Returns the value of attribute verify_iss.
-
#verify_token_signature ⇒ Object
Returns the value of attribute verify_token_signature.
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 14 def initialize @verify_token_signature = true @algorithms = 'RS256' @verify_iss = true @hmac_secret = nil @decode_params = nil @additional_params = {} @jwks = nil end |
Instance Attribute Details
#additional_params ⇒ Object
Returns the value of attribute additional_params.
11 12 13 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 11 def additional_params @additional_params end |
#algorithms ⇒ Object
Returns the value of attribute algorithms.
11 12 13 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 11 def algorithms @algorithms end |
#decode_params ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 26 def decode_params return @decode_params.merge(additional_params || {}) if @decode_params.present? { algorithms: algorithms, iss: issuer, verify_iss: verify_iss, jwks: jwks }.merge(additional_params || {}) end |
#hmac_secret ⇒ Object
Returns the value of attribute hmac_secret.
11 12 13 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 11 def hmac_secret @hmac_secret end |
#issuer ⇒ Object
Returns the value of attribute issuer.
11 12 13 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 11 def issuer @issuer end |
#jwks ⇒ Object
41 42 43 44 45 46 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 41 def jwks return @jwks if @jwks.present? jwks_raw = Net::HTTP.get URI(jwks_uri) JSON.parse(jwks_raw, symbolize_names: true) end |
#jwks_uri ⇒ Object
Returns the value of attribute jwks_uri.
11 12 13 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 11 def jwks_uri @jwks_uri end |
#verify_iss ⇒ Object
Returns the value of attribute verify_iss.
11 12 13 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 11 def verify_iss @verify_iss end |
#verify_token_signature ⇒ Object
Returns the value of attribute verify_token_signature.
11 12 13 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 11 def verify_token_signature @verify_token_signature end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
37 38 39 |
# File 'lib/minato/rails/auth/jwt/configuration.rb', line 37 def configure yield(self) if block_given? end |