Module: Warden::Auth0
- Extended by:
- Dry::Configurable
- Defined in:
- lib/warden/auth0.rb,
lib/warden/auth0/errors.rb,
lib/warden/auth0/version.rb,
lib/warden/auth0/strategy.rb,
lib/warden/auth0/env_helper.rb,
lib/warden/auth0/header_parser.rb,
lib/warden/auth0/token_decoder.rb
Overview
Auth0 authentication plugin for warden.
It consists of a strategy which tries to authenticate an user decoding a token present in the ‘Authentication` header (as `Bearer %token%`).
Defined Under Namespace
Modules: EnvHelper, Errors, HeaderParser Classes: Strategy, TokenDecoder
Constant Summary collapse
- Import =
Dry::AutoInject(config)
- VERSION =
'0.5.1'
Class Method Summary collapse
- .connection ⇒ Object
-
.fetch_jwks(jwks_url) ⇒ Object
Method to fetch JWKS from the specified URL.
Class Method Details
.connection ⇒ Object
55 56 57 58 59 |
# File 'lib/warden/auth0.rb', line 55 def self.connection Faraday.new(request: { timeout: 5 }, ssl: { verify: config.verify_ssl }) do |conn| conn.response :json end end |
.fetch_jwks(jwks_url) ⇒ Object
Method to fetch JWKS from the specified URL
45 46 47 48 49 50 51 52 53 |
# File 'lib/warden/auth0.rb', line 45 def self.fetch_jwks(jwks_url) raise 'No url provided for fetching jwks' if jwks_url.nil? jwks_response = connection.get(jwks_url).body jwks = JWT::JWK::Set.new(jwks_response) jwks.select { |key| key[:use] == 'sig' } rescue StandardError => e raise "Failed to fetch JWKS: #{e.}" end |