rack-prx_auth 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53764ad6c8d28d070c297e861583800e8695f730
4
- data.tar.gz: 25df2b4ac3cdfa4ed82336b4f21e2d1bd81611c3
3
+ metadata.gz: 335167c8922061c767796b85563f9f7b5378a6e9
4
+ data.tar.gz: 523fd6da97985c6e2e9f78aa20a51d570411dc37
5
5
  SHA512:
6
- metadata.gz: c948e9875aeb2d5f26467a8b6305fc25b6b7f33aa2579df68a1d7ae2b528ca6e8957d3fde85f892b1600335548c7e89120b3d3df85e8e50ffb18bc410bc1671e
7
- data.tar.gz: 4ff2517a84b28cfd8eeac03ba05ffc2d06ed26874b77c6f6f6cc29c67cd59c683fdf671b3078967c7df0b5fd8762dae0fa3f1b7bd7ad2ea22b5a42be9b5a3e24
6
+ metadata.gz: f28ac978ac7e87da00f7495da26ff391a2794aecb5c8915052516b414964f800fc6779fe5c087ffce9ecc7612f58ab1caf6f1007a7a4a139a23cc80abbdcafcd
7
+ data.tar.gz: a3a3055cfc30a9ececdf51bcb8dd91e2c468e0f10902bd242150dda3a8560878d89fd4f981f256a8b8f882086a26ca102f4d44b23720ca3d2320fccae66ee596
@@ -6,6 +6,10 @@ module Rack
6
6
  end
7
7
 
8
8
  attr_reader :attributes
9
+
10
+ def user_id
11
+ @attributes['sub']
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class PrxAuth
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ describe Rack::PrxAuth do
8
8
  let(:prxauth) { Rack::PrxAuth.new(app) }
9
9
  let(:fake_token) { 'afawefawefawefawegstgnsrtiohnlijblublwjnvrtoign'}
10
10
  let(:env) { {'HTTP_AUTHORIZATION' => 'Bearer ' + fake_token } }
11
- let(:claims) { {'sub'=>nil, 'exp'=>3600, 'iat'=>Time.now.to_i, 'token_type'=>'bearer', 'scope'=>nil, 'iss'=>'auth.prx.org'} }
11
+ let(:claims) { {'sub'=>3, 'exp'=>3600, 'iat'=>Time.now.to_i, 'token_type'=>'bearer', 'scope'=>nil, 'iss'=>'auth.prx.org'} }
12
12
 
13
13
  describe '#call' do
14
14
  it 'does nothing if there is no authorization header' do
@@ -57,6 +57,7 @@ describe Rack::PrxAuth do
57
57
  JSON::JWT.stub(:decode, claims) do
58
58
  prxauth.call(env)['prx.auth'].must_be_instance_of Rack::PrxAuth::TokenData
59
59
  prxauth.call(env)['prx.auth'].attributes.must_equal claims
60
+ prxauth.call(env)['prx.auth'].user_id.must_equal claims['sub']
60
61
  end
61
62
  end
62
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-prx_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eve Asher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-01 00:00:00.000000000 Z
11
+ date: 2014-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler