soar_authentication_token 6.1.0 → 6.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92fc0e5a387e08484ae5b0c48a466d46bed16244
|
4
|
+
data.tar.gz: 9b1cbc9f2f41572daf9ed0a917f996f11bf4f141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af46ea8e47641f8efde6130ed715b2332e47dc15fdf7203d282859fe70759079df9d721b1e43273a7584482d3d76f7664f4ffbd197cd80e37ee15c0a9d42d9b7
|
7
|
+
data.tar.gz: 611a3f9db6afe3e9e1d00fafab33cc7eaad33bba69e695a083cdecf3b43abedc8cafafd83660461f30354b5ce229aea1a57b8b2e6184aa8098d045288ef858c7
|
@@ -11,5 +11,4 @@ require 'soar_authentication_token/config_rotator'
|
|
11
11
|
require 'soar_authentication_token/token_generator'
|
12
12
|
require 'soar_authentication_token/token_validator'
|
13
13
|
require 'soar_authentication_token/rack_middleware'
|
14
|
-
require 'soar_authentication_token/rack_auth_id_transposer_middleware'
|
15
14
|
require 'soar_authentication_token/version'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_authentication_token
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barney de Villiers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soar_xt
|
@@ -230,7 +230,6 @@ files:
|
|
230
230
|
- lib/soar_authentication_token/providers/remote_token_generator.rb
|
231
231
|
- lib/soar_authentication_token/providers/remote_token_validator.rb
|
232
232
|
- lib/soar_authentication_token/providers/static_token_validator.rb
|
233
|
-
- lib/soar_authentication_token/rack_auth_id_transposer_middleware.rb
|
234
233
|
- lib/soar_authentication_token/rack_middleware.rb
|
235
234
|
- lib/soar_authentication_token/token_generator.rb
|
236
235
|
- lib/soar_authentication_token/token_validator.rb
|
@@ -245,7 +244,6 @@ files:
|
|
245
244
|
- spec/config_rotator_spec.rb
|
246
245
|
- spec/jwt_token_validator_spec.rb
|
247
246
|
- spec/keypair_generator_spec.rb
|
248
|
-
- spec/rack_auth_id_transposer_middleware_spec.rb
|
249
247
|
- spec/rack_middleware_spec.rb
|
250
248
|
- spec/remote_token_validator_spec.rb
|
251
249
|
- spec/spec_helper.rb
|
@@ -280,7 +278,6 @@ test_files:
|
|
280
278
|
- spec/config_rotator_spec.rb
|
281
279
|
- spec/jwt_token_validator_spec.rb
|
282
280
|
- spec/keypair_generator_spec.rb
|
283
|
-
- spec/rack_auth_id_transposer_middleware_spec.rb
|
284
281
|
- spec/rack_middleware_spec.rb
|
285
282
|
- spec/remote_token_validator_spec.rb
|
286
283
|
- spec/spec_helper.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rack'
|
2
|
-
|
3
|
-
module SoarAuthenticationToken
|
4
|
-
class RackAuthIdTransposerMiddleware
|
5
|
-
def initialize(app)
|
6
|
-
@app = app
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
request = Rack::Request.new env
|
11
|
-
authenticated_identifier = request.env['X-GATEWAY-AUTHENTICATED-IDENTIFIER']
|
12
|
-
if authenticated_identifier
|
13
|
-
request.session['user'] = authenticated_identifier
|
14
|
-
request.env['REMOTE_USER'] = authenticated_identifier
|
15
|
-
end
|
16
|
-
return @app.call env
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rack'
|
3
|
-
require 'rack/test'
|
4
|
-
|
5
|
-
describe SoarAuthenticationToken::RackAuthIdTransposerMiddleware do
|
6
|
-
include Rack::Test::Methods
|
7
|
-
|
8
|
-
before :each do
|
9
|
-
@test_app = lambda do |env|
|
10
|
-
request = Rack::Request.new env
|
11
|
-
session = request.session
|
12
|
-
test_app_response_data = {
|
13
|
-
'message' => "tested",
|
14
|
-
'session_user' => request.session['user'],
|
15
|
-
'remote_user' => request.env['REMOTE_USER']
|
16
|
-
}
|
17
|
-
[200, {"Content-Type" => "application/json"}, test_app_response_data ]
|
18
|
-
end
|
19
|
-
@iut = SoarAuthenticationToken::RackAuthIdTransposerMiddleware.new(@test_app)
|
20
|
-
end
|
21
|
-
|
22
|
-
context "when initialized" do
|
23
|
-
it 'remembers the app provided' do
|
24
|
-
expect(@iut.instance_variable_get("@app")).to eq(@test_app)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "when called with a request environment" do
|
29
|
-
context 'with X-GATEWAY-AUTHENTICATED-IDENTIFIER header' do
|
30
|
-
it "pass requests to the application" do
|
31
|
-
opts = { 'X-GATEWAY-AUTHENTICATED-IDENTIFIER' => 'test_uuid' }
|
32
|
-
code, env, body = @iut.call Rack::MockRequest.env_for('http://service', opts)
|
33
|
-
expect([code, env, body['message']]).to eq([200, {"Content-Type"=>"application/json"}, "tested"])
|
34
|
-
end
|
35
|
-
|
36
|
-
it "set the user key in the request session" do
|
37
|
-
opts = { 'X-GATEWAY-AUTHENTICATED-IDENTIFIER' => 'test_uuid' }
|
38
|
-
code, env, body = @iut.call Rack::MockRequest.env_for('http://service', opts)
|
39
|
-
expect(body['session_user']).to eq 'test_uuid'
|
40
|
-
end
|
41
|
-
|
42
|
-
it "set the remote user in the request environment" do
|
43
|
-
opts = { 'X-GATEWAY-AUTHENTICATED-IDENTIFIER' => 'test_uuid' }
|
44
|
-
code, env, body = @iut.call Rack::MockRequest.env_for('http://service', opts)
|
45
|
-
expect(body['remote_user']).to eq 'test_uuid'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'without X-GATEWAY-AUTHENTICATED-IDENTIFIER header' do
|
50
|
-
it "pass requests to the application" do
|
51
|
-
opts = { }
|
52
|
-
code, env, body = @iut.call Rack::MockRequest.env_for('http://service', opts)
|
53
|
-
expect([code, env, body['message'], body['session_user'], body['remote_user']]).to eq([200, {"Content-Type"=>"application/json"}, "tested", nil, nil])
|
54
|
-
end
|
55
|
-
|
56
|
-
it "does not modify the user key in the request session" do
|
57
|
-
opts = { }
|
58
|
-
code, env, body = @iut.call Rack::MockRequest.env_for('http://service', opts)
|
59
|
-
expect(body['session_user']).to eq nil
|
60
|
-
end
|
61
|
-
|
62
|
-
it "does not modify the remote user in the request environment" do
|
63
|
-
opts = { }
|
64
|
-
code, env, body = @iut.call Rack::MockRequest.env_for('http://service', opts)
|
65
|
-
expect(body['remote_user']).to eq nil
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|