keratin-authn 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42fc6f727891054b77a0e1b4e456d3f436206de8
4
- data.tar.gz: d890d883753d1a44ddaaf868c9ca0f6a1445cfcf
3
+ metadata.gz: 847208e3ba358b73e2d6cee499b41646493527b2
4
+ data.tar.gz: f1c1b9b89095596627089c2a2daa603c0b951195
5
5
  SHA512:
6
- metadata.gz: ec8ecab45a116040c1163032d8b5bd01e2815e6391fcddfb9ad0b3463025f17c1820eee498d3f6a4a5c00f9aacc6218dd209768272f692c1e28791eb865cdc73
7
- data.tar.gz: 8bf4b09aa819d05f7cdf42aa124c09fa94f1825b55803d334d8abd673ed3318563f96d7c2990e98870be0315696519c14bba39459835ed60e9d2e76a3ba98635
6
+ metadata.gz: a7c25eb47b0d5ae1b0a9cde426c9472c8731a8ede1a8bfb02ab8689f409e0f37ff7267d9fad88e9d91d5e53a05ac0d1ba705861403bd8ee8d77643aec4317674
7
+ data.tar.gz: 7ca65c1c66b67ce50e785b6e06b0c61fb7a47b2d8b9cdc0c52e95d617e982dfa0f5483b2a014c539cca3e6254b6c28977935283d20055af3560f870aac60a0ff
@@ -12,11 +12,16 @@ module Keratin::AuthN
12
12
 
13
13
  def verified?
14
14
  jwt.present? &&
15
+ token_from_us? &&
15
16
  token_for_us? &&
16
17
  !token_expired? &&
17
18
  token_intact?
18
19
  end
19
20
 
21
+ def token_from_us?
22
+ jwt[:iss] == Keratin::AuthN.config.issuer
23
+ end
24
+
20
25
  def token_for_us?
21
26
  jwt[:aud] == Keratin::AuthN.config.audience
22
27
  end
@@ -24,17 +24,17 @@ module Keratin::AuthN
24
24
  end
25
25
 
26
26
  # stubs the endpoints necessary to validate a signed JWT
27
- private def stub_auth_server
27
+ private def stub_auth_server(issuer: Keratin::AuthN.config.issuer, keypair: jws_keypair)
28
28
  Keratin::AuthN.keychain.clear
29
- stub_request(:get, "#{Keratin::AuthN.config.issuer}#{Keratin::AuthN.config.configuration_path}").to_return(
29
+ stub_request(:get, "#{issuer}#{Keratin::AuthN.config.configuration_path}").to_return(
30
30
  status: 200,
31
- body: {'jwks_uri' => "#{Keratin::AuthN.config.issuer}/jwks"}.to_json
31
+ body: {'jwks_uri' => "#{issuer}/jwks"}.to_json
32
32
  )
33
- stub_request(:get, "#{Keratin::AuthN.config.issuer}/jwks").to_return(
33
+ stub_request(:get, "#{issuer}/jwks").to_return(
34
34
  status: 200,
35
35
  body: {
36
36
  keys: [
37
- jws_keypair.public_key.to_jwk.slice(:kty, :kid, :e, :n).merge(
37
+ keypair.public_key.to_jwk.slice(:kty, :kid, :e, :n).merge(
38
38
  use: 'sig',
39
39
  alg: JWS_ALGORITHM
40
40
  )
@@ -1,5 +1,5 @@
1
1
  module Keratin
2
2
  module AuthN
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keratin-authn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lance Ivy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-18 00:00:00.000000000 Z
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-jwt