lib/keratin/authn/test/helpers.rb in keratin-authn-0.1.1 vs lib/keratin/authn/test/helpers.rb in keratin-authn-0.1.2
- old
+ new
@@ -22,20 +22,20 @@
private def jws_keypair
@keypair ||= OpenSSL::PKey::RSA.new(512)
end
# stubs the endpoints necessary to validate a signed JWT
- private def stub_auth_server
+ private def stub_auth_server(issuer: Keratin::AuthN.config.issuer, keypair: jws_keypair)
Keratin::AuthN.keychain.clear
- stub_request(:get, "#{Keratin::AuthN.config.issuer}#{Keratin::AuthN.config.configuration_path}").to_return(
+ stub_request(:get, "#{issuer}#{Keratin::AuthN.config.configuration_path}").to_return(
status: 200,
- body: {'jwks_uri' => "#{Keratin::AuthN.config.issuer}/jwks"}.to_json
+ body: {'jwks_uri' => "#{issuer}/jwks"}.to_json
)
- stub_request(:get, "#{Keratin::AuthN.config.issuer}/jwks").to_return(
+ stub_request(:get, "#{issuer}/jwks").to_return(
status: 200,
body: {
keys: [
- jws_keypair.public_key.to_jwk.slice(:kty, :kid, :e, :n).merge(
+ keypair.public_key.to_jwk.slice(:kty, :kid, :e, :n).merge(
use: 'sig',
alg: JWS_ALGORITHM
)
]
}.to_json