Sha256: 14ecade1d19e14442f31254759755b8ab2bd17830798a1d336d1f6ca6f0ecf5f

Contents?: true

Size: 774 Bytes

Versions: 16

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

# This is a mock verifier that allows the auth0_rs256_jwt_verifier gem
# to still be used for verifying JWTs, but with a localhost JWKS specified.
# This code was adapted from the gem's test suite:
# https://github.com/DroidsOnRoids/auth0_rs256_jwt_verifier/blob/master/test/auth0_rs256_jwt_verifier_test.rb
class MockAuth0Verifier
  def initialize(issuer:, audience:, jwks:)
    @internal_verifier = Auth0RS256JWTVerifier.new(
      issuer: issuer,
      audience: audience,
      jwks_url: "https://do.not.care",
      http: http_stub(jwks)
    )
  end

  delegate :verify, to: :@internal_verifier

  private

  def http_stub(jwks)
    http_stub = Object.new
    http_stub.define_singleton_method(:get) { |*_| jwks }
    http_stub
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
nulogy_sso-2.5.1 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.5.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.4.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.3.1 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.3.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.2.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.1.3 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.1.2 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.1.1 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.1.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-2.0.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-1.0.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-0.5.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-0.4.0 spec/support/mock_auth0_verifier.rb
nulogy_sso-0.3.3 spec/support/mock_auth0_verifier.rb
nulogy_sso-0.3.1 spec/support/mock_auth0_verifier.rb