soar_authentication_token 1.0.0 → 2.0.0
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 +4 -4
- data/.gitmodules +4 -0
- data/docker-compose-isolated.yml +48 -0
- data/docker-compose.yml +22 -1
- data/lib/soar_authentication_token/token_generator.rb +3 -1
- data/lib/soar_authentication_token/token_validator.rb +1 -1
- data/lib/soar_authentication_token/version.rb +1 -1
- data/spec/token_generator_spec.rb +6 -7
- data/spec/token_validator_spec.rb +8 -8
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64a56545b16db366bd879f1c809320b71376327
|
4
|
+
data.tar.gz: 735dc7c143e3a5f500e2a8e04fe37bd5822ad920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df0acc8c762e6984ea5dc5014a01399af4f21f69bf6568d5c343445932cf82792b443effa92d595df0c28c0483621ffabdecce9527210a2759ad71051119b94f
|
7
|
+
data.tar.gz: 94037e0ec776a1dea90b25aa9d8ccec2cc8f51ec44a856900d6b46266facf7c30b0039ac746abb0ac79f3ac6f27127a519276416c744980aa1a87b3879284ae6
|
data/.gitmodules
CHANGED
@@ -6,3 +6,7 @@
|
|
6
6
|
path = authentication-token-validator-service
|
7
7
|
url = git@gitlab.host-h.net:hetznerZA/authentication-token-validator-service.git
|
8
8
|
branch = master
|
9
|
+
[submodule "authentication-token-store"]
|
10
|
+
path = authentication-token-store
|
11
|
+
url = git@gitlab.host-h.net:hetznerZA/authentication-token-store.git
|
12
|
+
branch = master
|
@@ -0,0 +1,48 @@
|
|
1
|
+
version: '2.0'
|
2
|
+
services:
|
3
|
+
soar-authentication-token:
|
4
|
+
command: /bin/bash -c 'sleep 5; bundle exec rspec -cfd spec'
|
5
|
+
build: .
|
6
|
+
image: soar-authentication-token
|
7
|
+
volumes:
|
8
|
+
- .:/usr/local/src/
|
9
|
+
links:
|
10
|
+
- authentication-token-generator-service
|
11
|
+
- authentication-token-validator-service
|
12
|
+
authentication-token-generator-service:
|
13
|
+
build: authentication-token-generator-service
|
14
|
+
image: authentication-token-generator-service
|
15
|
+
expose:
|
16
|
+
- "9393"
|
17
|
+
volumes:
|
18
|
+
- ./authentication-token-generator-service:/usr/local/src/
|
19
|
+
environment:
|
20
|
+
- RACK_ENV=development
|
21
|
+
- ENVIRONMENT_FILE=environment_local_ecosystem.yml
|
22
|
+
links:
|
23
|
+
- authentication-token-store
|
24
|
+
authentication-token-validator-service:
|
25
|
+
build: authentication-token-validator-service
|
26
|
+
image: authentication-token-validator-service
|
27
|
+
expose:
|
28
|
+
- "9393"
|
29
|
+
volumes:
|
30
|
+
- ./authentication-token-validator-service:/usr/local/src/
|
31
|
+
environment:
|
32
|
+
- RACK_ENV=development
|
33
|
+
- ENVIRONMENT_FILE=environment_local_ecosystem.yml
|
34
|
+
links:
|
35
|
+
- authentication-token-store
|
36
|
+
authentication-token-store:
|
37
|
+
build: authentication-token-store
|
38
|
+
image: authentication-token-store
|
39
|
+
command: soaring start
|
40
|
+
expose:
|
41
|
+
- "9393"
|
42
|
+
environment:
|
43
|
+
- RACK_ENV=development
|
44
|
+
- ENVIRONMENT_FILE=environment_local_ecosystem.yml
|
45
|
+
links:
|
46
|
+
- authentication-token-redis-store
|
47
|
+
authentication-token-redis-store:
|
48
|
+
image: redis
|
data/docker-compose.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
version: '2.0'
|
2
2
|
services:
|
3
3
|
soar-authentication-token:
|
4
|
-
command: /bin/bash -c 'sleep 5; bundle
|
4
|
+
command: /bin/bash -c 'sleep 5; bundle exec rspec -cfd spec'
|
5
5
|
build: .
|
6
6
|
image: soar-authentication-token
|
7
7
|
volumes:
|
@@ -14,18 +14,39 @@ services:
|
|
14
14
|
image: authentication-token-generator-service
|
15
15
|
expose:
|
16
16
|
- "9393"
|
17
|
+
ports:
|
18
|
+
- "7001:9393"
|
17
19
|
volumes:
|
18
20
|
- ./authentication-token-generator-service:/usr/local/src/
|
19
21
|
environment:
|
20
22
|
- RACK_ENV=development
|
21
23
|
- ENVIRONMENT_FILE=environment_local_ecosystem.yml
|
24
|
+
links:
|
25
|
+
- authentication-token-store
|
22
26
|
authentication-token-validator-service:
|
23
27
|
build: authentication-token-validator-service
|
24
28
|
image: authentication-token-validator-service
|
25
29
|
expose:
|
26
30
|
- "9393"
|
31
|
+
ports:
|
32
|
+
- "7002:9393"
|
27
33
|
volumes:
|
28
34
|
- ./authentication-token-validator-service:/usr/local/src/
|
29
35
|
environment:
|
30
36
|
- RACK_ENV=development
|
31
37
|
- ENVIRONMENT_FILE=environment_local_ecosystem.yml
|
38
|
+
links:
|
39
|
+
- authentication-token-store
|
40
|
+
authentication-token-store:
|
41
|
+
build: authentication-token-store
|
42
|
+
image: authentication-token-store
|
43
|
+
command: soaring start
|
44
|
+
expose:
|
45
|
+
- "9393"
|
46
|
+
environment:
|
47
|
+
- RACK_ENV=development
|
48
|
+
- ENVIRONMENT_FILE=environment_local_ecosystem.yml
|
49
|
+
links:
|
50
|
+
- authentication-token-redis-store
|
51
|
+
authentication-token-redis-store:
|
52
|
+
image: redis
|
@@ -30,7 +30,9 @@ module SoarAuthenticationToken
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def generate_locally(authenticated_identifier)
|
33
|
-
|
33
|
+
token_meta = meta(authenticated_identifier)
|
34
|
+
token = encode(token_meta)
|
35
|
+
[token, token_meta]
|
34
36
|
end
|
35
37
|
|
36
38
|
def generate_remotely(authenticated_identifier,flow_identifier)
|
@@ -71,7 +71,7 @@ module SoarAuthenticationToken
|
|
71
71
|
body = JSON.parse(response.body)
|
72
72
|
if 'success' == body['status']
|
73
73
|
raise 'Token validation service did not provide authenticated_identifier' if body['data'].nil? or body['data']['authenticated_identifier'].nil?
|
74
|
-
return [true, body['data']
|
74
|
+
return [true, body['data']]
|
75
75
|
end
|
76
76
|
if 'fail' == body['status']
|
77
77
|
return [false, nil]
|
@@ -42,11 +42,10 @@ describe SoarAuthenticationToken::TokenGenerator do
|
|
42
42
|
@validator = SoarAuthenticationToken::TokenValidator.new(@validator_configuration_local)
|
43
43
|
@validator.inject_store_provider(@test_store)
|
44
44
|
|
45
|
-
token = @iut.generate(authenticated_identifier: @test_authenticated_identifier, flow_identifier: 'test-flow-id')
|
46
|
-
token_validity,
|
47
|
-
|
45
|
+
token, token_generator_meta = @iut.generate(authenticated_identifier: @test_authenticated_identifier, flow_identifier: 'test-flow-id')
|
46
|
+
token_validity, token_validator_meta = @validator.validate(authentication_token: token, flow_identifier: 'test-flow-id')
|
48
47
|
expect(token_validity).to eq(true)
|
49
|
-
expect(
|
48
|
+
expect(token_validator_meta['authenticated_identifier']).to eq(@test_authenticated_identifier)
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
@@ -55,14 +54,14 @@ describe SoarAuthenticationToken::TokenGenerator do
|
|
55
54
|
@iut = SoarAuthenticationToken::TokenGenerator.new(@configuration_remote)
|
56
55
|
@iut.inject_store_provider(@test_store)
|
57
56
|
|
58
|
-
token = @iut.generate(authenticated_identifier: @test_authenticated_identifier, flow_identifier: 'test-flow-id')
|
57
|
+
token, token_generator_meta = @iut.generate(authenticated_identifier: @test_authenticated_identifier, flow_identifier: 'test-flow-id')
|
59
58
|
|
60
59
|
@validator = SoarAuthenticationToken::TokenValidator.new(@configuration_remote)
|
61
60
|
@iut.inject_store_provider(@test_store)
|
62
|
-
token_validity,
|
61
|
+
token_validity, token_validator_meta = @validator.validate(authentication_token: token, flow_identifier: 'test-flow-id')
|
63
62
|
|
64
63
|
expect(token_validity).to eq(true)
|
65
|
-
expect(
|
64
|
+
expect(token_validator_meta['authenticated_identifier']).to eq(@test_authenticated_identifier)
|
66
65
|
end
|
67
66
|
end
|
68
67
|
end
|
@@ -50,25 +50,25 @@ describe SoarAuthenticationToken::TokenValidator do
|
|
50
50
|
|
51
51
|
context "when validating a token locally using the configured public key" do
|
52
52
|
it 'should indicate valid if the token is valid' do
|
53
|
-
token = @local_valid_generator.generate(authenticated_identifier: @test_identifier)
|
53
|
+
token, token_generator_meta = @local_valid_generator.generate(authenticated_identifier: @test_identifier)
|
54
54
|
token_validity, token_meta = @iut_local.validate(authentication_token: token)
|
55
55
|
expect(token_validity).to eq true
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should indicate invalid if the token is invalid' do
|
59
|
-
token = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
59
|
+
token, token_generator_meta = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
60
60
|
token_validity, token_meta = @iut_local.validate(authentication_token: token)
|
61
61
|
expect(token_validity).to eq false
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'should provide the authenticated_identifier if the token is valid' do
|
65
|
-
token = @local_valid_generator.generate(authenticated_identifier: @test_identifier)
|
65
|
+
token, token_generator_meta = @local_valid_generator.generate(authenticated_identifier: @test_identifier)
|
66
66
|
token_validity, token_meta = @iut_local.validate(authentication_token: token)
|
67
67
|
expect(token_meta['authenticated_identifier']).to eq @test_identifier
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should not provide the authenticated_identifier if the token is invalid' do
|
71
|
-
token = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
71
|
+
token, token_generator_meta = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
72
72
|
token_validity, token_meta = @iut_local.validate(authentication_token: token)
|
73
73
|
expect(token_meta).to eq nil
|
74
74
|
end
|
@@ -86,25 +86,25 @@ describe SoarAuthenticationToken::TokenValidator do
|
|
86
86
|
|
87
87
|
context "when validating a token remotely using the configured url" do
|
88
88
|
it 'should indicate valid if the token is valid' do
|
89
|
-
token = @remote_generator.generate(authenticated_identifier: @test_identifier)
|
89
|
+
token, token_generator_meta = @remote_generator.generate(authenticated_identifier: @test_identifier)
|
90
90
|
token_validity, token_meta = @iut_remote.validate(authentication_token: token)
|
91
91
|
expect(token_validity).to eq true
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'should indicate invalid if the token is invalid' do
|
95
|
-
token = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
95
|
+
token, token_generator_meta = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
96
96
|
token_validity, token_meta = @iut_remote.validate(authentication_token: token)
|
97
97
|
expect(token_validity).to eq false
|
98
98
|
end
|
99
99
|
|
100
100
|
it 'should provide the authenticated_identifier if the token is valid' do
|
101
|
-
token = @remote_generator.generate(authenticated_identifier: @test_identifier)
|
101
|
+
token, token_generator_meta = @remote_generator.generate(authenticated_identifier: @test_identifier)
|
102
102
|
token_validity, token_meta = @iut_remote.validate(authentication_token: token)
|
103
103
|
expect(token_meta['authenticated_identifier']).to eq @test_identifier
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'should not provide the authenticated_identifier if the token is invalid' do
|
107
|
-
token = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
107
|
+
token, token_generator_meta = @local_invalid_generator.generate(authenticated_identifier: @test_identifier)
|
108
108
|
token_validity, token_meta = @iut_remote.validate(authentication_token: token)
|
109
109
|
expect(token_meta).to eq nil
|
110
110
|
end
|
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:
|
4
|
+
version: 2.0.0
|
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-01-
|
11
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soar_xt
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- bin/console
|
178
178
|
- bin/keypair-generator
|
179
179
|
- bin/setup
|
180
|
+
- docker-compose-isolated.yml
|
180
181
|
- docker-compose.yml
|
181
182
|
- lib/soar_authentication_token.rb
|
182
183
|
- lib/soar_authentication_token/keypair_generator.rb
|