auth_token_store_provider 1.0.1
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 +7 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Dockerfile +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +84 -0
- data/Rakefile +6 -0
- data/auth_token_store_provider.gemspec +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/auth_token_store_provider.rb +6 -0
- data/lib/auth_token_store_provider/client.rb +70 -0
- data/lib/auth_token_store_provider/stub_client.rb +55 -0
- data/lib/auth_token_store_provider/version.rb +3 -0
- data/sanity/.ruby-gemset +1 -0
- data/sanity/.ruby-version +1 -0
- data/sanity/Gemfile +3 -0
- data/sanity/sanity.rb +10 -0
- data/spec/client_spec.rb +335 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/stub_client_spec.rb +350 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d9b7f73982b9a9a3ee1f279630add22133eda53
|
4
|
+
data.tar.gz: 31e1aa63b0792770d5cb802ec2bb203012fe3a35
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 924e9a3b0f803482e4b15bcd57b36f5a78d0ef7b532627753ad039279df08067974e323f75d645d929f4d3dc8e45a8e6ee76fc4529503a1fd181ae6a19d10bac
|
7
|
+
data.tar.gz: a41df3efa695ea28abfb1e6531e796b3bf7a4824107e7cd857980562fcc656cda80942f245d8927237b0ada5da98e1b296ad9cbf48bc42bf3ee653b65e928376
|
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
auth_token_store_provider
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.3.0
|
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Barney de Villiers
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# AuthTokenStoreProvider
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/authentication_token_store)
|
4
|
+
|
5
|
+
This gem provides authentication token storage client library in order to interface with the authentication token storage service.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'auth_token_store_provider'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install authentication_token_store --source http://gems.hetzner.co.za
|
22
|
+
|
23
|
+
|
24
|
+
## Testing
|
25
|
+
|
26
|
+
Locally run the tests:
|
27
|
+
|
28
|
+
$ bundle exec rspec -cfd spec/*
|
29
|
+
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
### StubClient
|
34
|
+
```
|
35
|
+
provider = AuthTokenStoreProvider::StubClient.new
|
36
|
+
```
|
37
|
+
### Adding a token
|
38
|
+
```
|
39
|
+
provider.add(token_identifier: '4603547ba5bdc6',
|
40
|
+
authenticated_identifier: 'uuid123',
|
41
|
+
token_issue_time: '2017-01-11T14:00:36+02:00',
|
42
|
+
token_expiry_time: '2017-01-12T14:00:36+02:00')
|
43
|
+
```
|
44
|
+
|
45
|
+
### Removing a token
|
46
|
+
```
|
47
|
+
provider.remove(token_identifier: '4603547ba5bdc6')
|
48
|
+
```
|
49
|
+
|
50
|
+
### Removing all tokens for a authenticated_identifier
|
51
|
+
```
|
52
|
+
provider.remove_tokens_for(authenticated_identifier: 'uuid123')
|
53
|
+
```
|
54
|
+
|
55
|
+
### Determine if a token exist
|
56
|
+
```
|
57
|
+
provider.token_exist?(
|
58
|
+
token_identifier: '4603547ba5bdc6',
|
59
|
+
authenticated_identifier: 'uuid123',
|
60
|
+
token_issue_time: '2017-01-11T14:00:36+02:00',
|
61
|
+
token_expiry_time: '2017-01-12T14:00:36+02:00'
|
62
|
+
)
|
63
|
+
```
|
64
|
+
|
65
|
+
### List all tokens for a authenticated_identifier
|
66
|
+
```
|
67
|
+
provider.subject.list_tokens_for(authenticated_identifier: 'uuid123')
|
68
|
+
```
|
69
|
+
|
70
|
+
## Detailed example
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
Bug reports and feature requests are welcome by email to barney dot de dot villiers at hetzner dot co dot za. This gem is sponsored by Hetzner (Pty) Ltd (http://hetzner.co.za)
|
77
|
+
|
78
|
+
## Notes
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
## License
|
83
|
+
|
84
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'auth_token_store_provider/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "auth_token_store_provider"
|
8
|
+
spec.version = AuthenticationTokenStore::VERSION
|
9
|
+
spec.authors = ["Barney de Villiers", "Tiaan van Deventer"]
|
10
|
+
spec.email = ["barney.de.villiers@hetzner.co.za", "tiaan.van.deventer@hetzner.co.za"]
|
11
|
+
spec.description = %q{Client provider library for the authentication token storage service}
|
12
|
+
spec.summary = %q{Client provider library for the authentication token storage service in order to interface with the storage programmatically}
|
13
|
+
spec.homepage = "https://gitlab.host-h.net/hetznerZA/authentication-token-store"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'authenticated_client', '~> 0.0.2'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'pry', '~> 0'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 2.13'
|
27
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "authentication_token_store"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'authenticated_client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module AuthTokenStoreProvider
|
5
|
+
class Client
|
6
|
+
def initialize(configuration)
|
7
|
+
@configuration = configuration
|
8
|
+
validate_configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
def add(token_identifier:, authenticated_identifier:, token_issue_time:, token_expiry_time:, flow_identifier: nil)
|
12
|
+
request_body = {
|
13
|
+
'authenticated_identifier' => authenticated_identifier,
|
14
|
+
'token_identifier' => token_identifier,
|
15
|
+
'token_issue_time' => token_issue_time,
|
16
|
+
'token_expiry_time' => token_expiry_time
|
17
|
+
}
|
18
|
+
response = perform_request(resource: 'add',
|
19
|
+
body: request_body,
|
20
|
+
flow_identifier: flow_identifier)
|
21
|
+
'success' == JSON.parse(response.body)['status']
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove(token_identifier:, flow_identifier: nil)
|
25
|
+
request_body = { 'token_identifier' => token_identifier }
|
26
|
+
response = perform_request(resource: 'remove',
|
27
|
+
body: request_body,
|
28
|
+
flow_identifier: flow_identifier)
|
29
|
+
'success' == JSON.parse(response.body)['status']
|
30
|
+
end
|
31
|
+
|
32
|
+
def token_exist?(token_identifier:, authenticated_identifier:, token_issue_time:, token_expiry_time:, flow_identifier: nil)
|
33
|
+
request_body = {
|
34
|
+
'authenticated_identifier' => authenticated_identifier,
|
35
|
+
'token_identifier' => token_identifier,
|
36
|
+
'token_issue_time' => token_issue_time,
|
37
|
+
'token_expiry_time' => token_expiry_time
|
38
|
+
}
|
39
|
+
response = perform_request(resource: 'check_existance',
|
40
|
+
body: request_body,
|
41
|
+
flow_identifier: flow_identifier)
|
42
|
+
JSON.parse(response.body)['data']['token_exist']
|
43
|
+
end
|
44
|
+
|
45
|
+
def remove_tokens_for(authenticated_identifier:, flow_identifier: nil)
|
46
|
+
raise RuntimeError, 'Not implemented'
|
47
|
+
end
|
48
|
+
|
49
|
+
def list_tokens_for(authenticated_identifier:, flow_identifier: nil)
|
50
|
+
raise RuntimeError, 'Not implemented'
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def validate_configuration
|
56
|
+
raise "element 'service_url' not in configuration" unless @configuration['service_url']
|
57
|
+
end
|
58
|
+
|
59
|
+
def perform_request(resource:, body:, flow_identifier:)
|
60
|
+
client = AuthenticatedClient::Client.new
|
61
|
+
client.url = "#{@configuration['service_url']}/#{resource}"
|
62
|
+
client.token = @configuration['auth_token']
|
63
|
+
client.verb = :post
|
64
|
+
client.parameters = { 'flow_identifier' => flow_identifier }
|
65
|
+
client.body = body if body
|
66
|
+
client.auditing = nil
|
67
|
+
response = client.request
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module AuthTokenStoreProvider
|
2
|
+
class StubClient
|
3
|
+
|
4
|
+
def initialize(configuration = {})
|
5
|
+
if configuration == {}
|
6
|
+
@store = []
|
7
|
+
elsif configuration['stub-data'] != {} || configuration['stub-data'] != nil
|
8
|
+
@store = configuration['stub-data']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def simulate_store_failure
|
13
|
+
@store_failure = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def add(token_identifier:, authenticated_identifier:, token_issue_time:, token_expiry_time:, flow_identifier: nil)
|
17
|
+
raise RuntimeError, 'Failure accessing store' if @store_failure
|
18
|
+
@store << { token_identifier: token_identifier,
|
19
|
+
authenticated_identifier: authenticated_identifier,
|
20
|
+
token_issue_time: token_issue_time,
|
21
|
+
token_expiry_time: token_expiry_time }
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove(token_identifier:, flow_identifier: nil)
|
25
|
+
raise RuntimeError, 'Failure accessing store' if @store_failure
|
26
|
+
@store.delete_if { |x| x[:token_identifier] == token_identifier }
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
def token_exist?(token_identifier:, authenticated_identifier:, token_issue_time:, token_expiry_time:, flow_identifier: nil)
|
31
|
+
raise RuntimeError, 'Failure accessing store' if @store_failure
|
32
|
+
|
33
|
+
@store.each { |x|
|
34
|
+
if ((x[:token_identifier] == token_identifier) and
|
35
|
+
(x[:authenticated_identifier] == authenticated_identifier) and
|
36
|
+
(x[:token_issue_time] == token_issue_time) and
|
37
|
+
(x[:token_expiry_time] == token_expiry_time))
|
38
|
+
return true
|
39
|
+
end
|
40
|
+
}
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
44
|
+
def remove_tokens_for(authenticated_identifier:, flow_identifier: nil)
|
45
|
+
raise RuntimeError, 'Failure accessing store' if @store_failure
|
46
|
+
@store.delete_if { |x| x[:authenticated_identifier] == authenticated_identifier }
|
47
|
+
true
|
48
|
+
end
|
49
|
+
|
50
|
+
def list_tokens_for(authenticated_identifier:, flow_identifier: nil)
|
51
|
+
raise RuntimeError, 'Failure accessing store' if @store_failure
|
52
|
+
@store.select { |x| x[:authenticated_identifier] == authenticated_identifier}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/sanity/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
sanity
|
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.3.0
|
data/sanity/Gemfile
ADDED
data/sanity/sanity.rb
ADDED
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,335 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
describe AuthTokenStoreProvider::Client do
|
5
|
+
|
6
|
+
subject { AuthTokenStoreProvider::Client.new(test_configuration) }
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
@test_token_identifier = create_test_token_identifier
|
10
|
+
@test_token_identifier_2 = create_test_token_identifier
|
11
|
+
@test_authenticated_identifier = 'someone'
|
12
|
+
@test_authenticated_identifier_2 = 'someone_else'
|
13
|
+
@test_token_token_issue_time = Time.now.utc.iso8601(3)
|
14
|
+
@test_token_token_issue_time_2 = Time.now.utc.iso8601(3)
|
15
|
+
@test_token_expiry_time = (Time.now+86400).utc.iso8601(3)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'has a version number' do
|
19
|
+
expect(AuthenticationTokenStore::VERSION).not_to be nil
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#initialize" do
|
23
|
+
context "when initializing the client" do
|
24
|
+
it 'saves the configuration' do
|
25
|
+
expect(subject.instance_variable_get('@configuration')).to eq test_configuration
|
26
|
+
end
|
27
|
+
it 'checks that the configuration is valid' do
|
28
|
+
expect{
|
29
|
+
AuthTokenStoreProvider::Client.new({})
|
30
|
+
}.to raise_error RuntimeError, "element 'service_url' not in configuration"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#add" do
|
36
|
+
context "when adding a token to the store" do
|
37
|
+
it 'responds with true' do
|
38
|
+
expect(
|
39
|
+
subject.token_exist?(
|
40
|
+
token_identifier: @test_token_identifier,
|
41
|
+
authenticated_identifier: @test_authenticated_identifier,
|
42
|
+
token_issue_time: @test_token_token_issue_time,
|
43
|
+
token_expiry_time: @test_token_expiry_time
|
44
|
+
)
|
45
|
+
).to eq false
|
46
|
+
|
47
|
+
subject.add(
|
48
|
+
token_identifier: @test_token_identifier,
|
49
|
+
authenticated_identifier: @test_authenticated_identifier,
|
50
|
+
token_issue_time: @test_token_token_issue_time,
|
51
|
+
token_expiry_time: @test_token_expiry_time
|
52
|
+
)
|
53
|
+
|
54
|
+
expect(
|
55
|
+
subject.token_exist?(
|
56
|
+
token_identifier: @test_token_identifier,
|
57
|
+
authenticated_identifier: @test_authenticated_identifier,
|
58
|
+
token_issue_time: @test_token_token_issue_time,
|
59
|
+
token_expiry_time: @test_token_expiry_time
|
60
|
+
)
|
61
|
+
).to eq true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "when unable to store a token due to an error" do
|
66
|
+
it 'responds with an error' do
|
67
|
+
expect(subject.token_exist?(
|
68
|
+
token_identifier: @test_token_identifier,
|
69
|
+
authenticated_identifier: @test_authenticated_identifier,
|
70
|
+
token_issue_time: @test_token_token_issue_time,
|
71
|
+
token_expiry_time: @test_token_expiry_time)
|
72
|
+
).to eq false
|
73
|
+
|
74
|
+
simulate_storage_failure(subject)
|
75
|
+
|
76
|
+
expect{
|
77
|
+
subject.add(token_identifier: @test_token_identifier,
|
78
|
+
authenticated_identifier: @test_authenticated_identifier,
|
79
|
+
token_issue_time: @test_token_token_issue_time,
|
80
|
+
token_expiry_time: @test_token_expiry_time
|
81
|
+
)
|
82
|
+
}.to raise_error Exception
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "#remove" do
|
88
|
+
context "Given an existing token with a unique token identifier" do
|
89
|
+
context "when the token is removed successfully" do
|
90
|
+
it "reponds with true" do
|
91
|
+
subject.add(token_identifier: @test_token_identifier,
|
92
|
+
authenticated_identifier: @test_authenticated_identifier,
|
93
|
+
token_issue_time: @test_token_token_issue_time,
|
94
|
+
token_expiry_time: @test_token_expiry_time)
|
95
|
+
|
96
|
+
expect(
|
97
|
+
subject.token_exist?(
|
98
|
+
token_identifier: @test_token_identifier,
|
99
|
+
authenticated_identifier: @test_authenticated_identifier,
|
100
|
+
token_issue_time: @test_token_token_issue_time,
|
101
|
+
token_expiry_time: @test_token_expiry_time
|
102
|
+
)
|
103
|
+
).to eq true
|
104
|
+
|
105
|
+
expect(
|
106
|
+
subject.remove(
|
107
|
+
token_identifier: @test_token_identifier
|
108
|
+
)
|
109
|
+
).to eq(true)
|
110
|
+
|
111
|
+
expect(
|
112
|
+
subject.token_exist?(
|
113
|
+
token_identifier: @test_token_identifier,
|
114
|
+
authenticated_identifier: @test_authenticated_identifier,
|
115
|
+
token_issue_time: @test_token_token_issue_time,
|
116
|
+
token_expiry_time: @test_token_expiry_time
|
117
|
+
)
|
118
|
+
).to eq false
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context "when unable to remove a token due to store error" do
|
123
|
+
it 'responds with an error' do
|
124
|
+
simulate_storage_failure(subject)
|
125
|
+
|
126
|
+
expect{
|
127
|
+
subject.remove(token_identifier: @test_token_identifier)
|
128
|
+
}.to raise_error Exception
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# describe "#removes_for" do
|
135
|
+
# context "when all the matching tokens for the authenticated indentifier has been removed successfully from the store" do
|
136
|
+
# it 'responds with true' do
|
137
|
+
# subject.add(
|
138
|
+
# token_identifier: @test_token_identifier,
|
139
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
140
|
+
# token_issue_time: @test_token_token_issue_time,
|
141
|
+
# token_expiry_time: @test_token_expiry_time
|
142
|
+
# )
|
143
|
+
#
|
144
|
+
# subject.add(
|
145
|
+
# token_identifier: @test_token_identifier_2,
|
146
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
147
|
+
# token_issue_time: @test_token_token_issue_time,
|
148
|
+
# token_expiry_time: @test_token_expiry_time
|
149
|
+
# )
|
150
|
+
#
|
151
|
+
# expect(
|
152
|
+
# subject.token_exist?(
|
153
|
+
# token_identifier: @test_token_identifier,
|
154
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
155
|
+
# token_issue_time: @test_token_token_issue_time,
|
156
|
+
# token_expiry_time: @test_token_expiry_time
|
157
|
+
# )
|
158
|
+
# ).to eq true
|
159
|
+
#
|
160
|
+
# expect(
|
161
|
+
# subject.token_exist?(
|
162
|
+
# token_identifier: @test_token_identifier_2,
|
163
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
164
|
+
# token_issue_time: @test_token_token_issue_time,
|
165
|
+
# token_expiry_time: @test_token_expiry_time
|
166
|
+
# )
|
167
|
+
# ).to eq true
|
168
|
+
#
|
169
|
+
# expect(
|
170
|
+
# subject.remove_tokens_for(
|
171
|
+
# authenticated_identifier: @test_authenticated_identifier
|
172
|
+
# )
|
173
|
+
# ).to eq(true)
|
174
|
+
#
|
175
|
+
# expect(
|
176
|
+
# subject.token_exist?(
|
177
|
+
# token_identifier: @test_token_identifier,
|
178
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
179
|
+
# token_issue_time: @test_token_token_issue_time,
|
180
|
+
# token_expiry_time: @test_token_expiry_time
|
181
|
+
# )
|
182
|
+
# ).to eq false
|
183
|
+
#
|
184
|
+
# expect(
|
185
|
+
# subject.token_exist?(
|
186
|
+
# token_identifier: @test_token_identifier_2,
|
187
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
188
|
+
# token_issue_time: @test_token_token_issue_time,
|
189
|
+
# token_expiry_time: @test_token_expiry_time
|
190
|
+
# )
|
191
|
+
# ).to eq false
|
192
|
+
# end
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# context "When a store error occurs while trying to remove all tokens for authenticated identifier" do
|
196
|
+
# it 'responds with an error' do
|
197
|
+
# simulate_storage_failure(subject)
|
198
|
+
#
|
199
|
+
# expect{
|
200
|
+
# subject.remove_tokens_for(authenticated_identifier: @test_authenticated_identifier)
|
201
|
+
# }.to raise_error Exception
|
202
|
+
# end
|
203
|
+
# end
|
204
|
+
# end
|
205
|
+
|
206
|
+
describe "#token_exist?" do
|
207
|
+
context "when searching for a existing and persisted token" do
|
208
|
+
it "responds with true" do
|
209
|
+
subject.add(token_identifier: @test_token_identifier,
|
210
|
+
authenticated_identifier: @test_authenticated_identifier,
|
211
|
+
token_issue_time: @test_token_token_issue_time,
|
212
|
+
token_expiry_time: @test_token_expiry_time)
|
213
|
+
|
214
|
+
expect(
|
215
|
+
subject.token_exist?(
|
216
|
+
token_identifier: @test_token_identifier,
|
217
|
+
authenticated_identifier: @test_authenticated_identifier,
|
218
|
+
token_issue_time: @test_token_token_issue_time,
|
219
|
+
token_expiry_time: @test_token_expiry_time
|
220
|
+
)
|
221
|
+
).to eq true
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
|
226
|
+
context "when the token is not persisted" do
|
227
|
+
it "responds with false" do
|
228
|
+
expect(
|
229
|
+
subject.token_exist?(
|
230
|
+
token_identifier: @test_token_identifier,
|
231
|
+
authenticated_identifier: @test_authenticated_identifier,
|
232
|
+
token_issue_time: @test_token_token_issue_time,
|
233
|
+
token_expiry_time: @test_token_expiry_time
|
234
|
+
)
|
235
|
+
).to eq false
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
context "when a token (but only with some of the elements) exist in the store" do
|
240
|
+
it "responds with false" do
|
241
|
+
subject.add(
|
242
|
+
token_identifier: @test_token_identifier,
|
243
|
+
authenticated_identifier: @test_identifier_2,
|
244
|
+
token_issue_time: @test_token_token_issue_time,
|
245
|
+
token_expiry_time: @test_token_expiry_time
|
246
|
+
)
|
247
|
+
|
248
|
+
expect(
|
249
|
+
subject.token_exist?(
|
250
|
+
token_identifier: @test_token_identifier,
|
251
|
+
authenticated_identifier: @test_authenticated_identifier,
|
252
|
+
token_issue_time: @test_token_token_issue_time,
|
253
|
+
token_expiry_time: @test_token_expiry_time
|
254
|
+
)
|
255
|
+
).to eq false
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
context "when unable to access the store" do
|
260
|
+
it "responds with an error" do
|
261
|
+
subject.add(
|
262
|
+
token_identifier: @test_token_identifier,
|
263
|
+
authenticated_identifier: @test_identifier,
|
264
|
+
token_issue_time: @test_token_token_issue_time,
|
265
|
+
token_expiry_time: @test_token_expiry_time
|
266
|
+
)
|
267
|
+
|
268
|
+
simulate_storage_failure(subject)
|
269
|
+
|
270
|
+
expect{
|
271
|
+
subject.token_exist?(
|
272
|
+
token_identifier: @test_token_identifier,
|
273
|
+
authenticated_identifier: @test_authenticated_identifier,
|
274
|
+
token_issue_time: @test_token_token_issue_time,
|
275
|
+
token_expiry_time: @test_token_expiry_time
|
276
|
+
)
|
277
|
+
}.to raise_error Exception
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
# describe "#list_tokens_for" do
|
283
|
+
# context "when searching for the list of tokens belonging to an authenticated identifer" do
|
284
|
+
# context "and there are not tokens for the authenticated identifer" do
|
285
|
+
# it "responds with an empty list" do
|
286
|
+
# expect(
|
287
|
+
# subject.list_tokens_for(authenticated_identifier: @test_authenticated_identifier)
|
288
|
+
# ).to eq([])
|
289
|
+
# end
|
290
|
+
# end
|
291
|
+
#
|
292
|
+
# it 'should provide a list of details if there are tokens for that authenticated identifer' do
|
293
|
+
# subject.add(
|
294
|
+
# token_identifier: @test_token_identifier,
|
295
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
296
|
+
# token_issue_time: @test_token_token_issue_time,
|
297
|
+
# token_expiry_time: @test_token_expiry_time
|
298
|
+
# )
|
299
|
+
#
|
300
|
+
# subject.add(
|
301
|
+
# token_identifier: @test_token_identifier_2,
|
302
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
303
|
+
# token_issue_time: @test_token_token_issue_time_2,
|
304
|
+
# token_expiry_time: @test_token_expiry_time
|
305
|
+
# )
|
306
|
+
#
|
307
|
+
# subject.add(
|
308
|
+
# token_identifier: @test_token_identifier_2,
|
309
|
+
# authenticated_identifier: @test_authenticated_identifier_2,
|
310
|
+
# token_issue_time: @test_token_token_issue_time_2,
|
311
|
+
# token_expiry_time: @test_token_expiry_time
|
312
|
+
# )
|
313
|
+
#
|
314
|
+
# expect(
|
315
|
+
# subject.list_tokens_for(authenticated_identifier: @test_authenticated_identifier)
|
316
|
+
# ).to eq(
|
317
|
+
# [
|
318
|
+
# {
|
319
|
+
# token_identifier: @test_token_identifier,
|
320
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
321
|
+
# token_issue_time: @test_token_token_issue_time,
|
322
|
+
# token_expiry_time: @test_token_expiry_time
|
323
|
+
# },
|
324
|
+
# {
|
325
|
+
# token_identifier: @test_token_identifier_2,
|
326
|
+
# authenticated_identifier: @test_authenticated_identifier,
|
327
|
+
# token_issue_time: @test_token_token_issue_time_2,
|
328
|
+
# token_expiry_time: @test_token_expiry_time
|
329
|
+
# }
|
330
|
+
# ]
|
331
|
+
# )
|
332
|
+
# end
|
333
|
+
# end
|
334
|
+
# end
|
335
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../spec/support', __FILE__)
|
3
|
+
|
4
|
+
require 'auth_token_store_provider'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
def create_test_token_identifier
|
8
|
+
SecureRandom.hex(32)
|
9
|
+
end
|
10
|
+
|
11
|
+
def simulate_storage_failure(subject)
|
12
|
+
if subject.class == AuthTokenStoreProvider::StubClient
|
13
|
+
subject.simulate_store_failure
|
14
|
+
end
|
15
|
+
if subject.class == AuthTokenStoreProvider::Client
|
16
|
+
subject.instance_variable_get("@configuration")['service_url'] = "http://authentication-token-store:1111/"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_configuration
|
21
|
+
{
|
22
|
+
'service_url' => 'http://authentication-token-store:9393/',
|
23
|
+
'auth_token' => 'test_ecosystem_token_for_auth_token_generator_service'
|
24
|
+
}
|
25
|
+
end
|
@@ -0,0 +1,350 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
describe AuthTokenStoreProvider::StubClient do
|
5
|
+
|
6
|
+
subject { AuthTokenStoreProvider::StubClient.new }
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
@test_token_identifier = create_test_token_identifier
|
10
|
+
@test_token_identifier_2 = create_test_token_identifier
|
11
|
+
@test_authenticated_identifier = 'someone'
|
12
|
+
@test_authenticated_identifier_2 = 'someone_else'
|
13
|
+
@test_token_token_issue_time = Time.now.utc.iso8601(3)
|
14
|
+
@test_token_token_issue_time_2 = Time.now.utc.iso8601(3)
|
15
|
+
@test_token_expiry_time = (Time.now+86400).utc.iso8601(3)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'has a version number' do
|
19
|
+
expect(AuthenticationTokenStore::VERSION).not_to be nil
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
describe "#initialize" do
|
24
|
+
context "Given stub data, it populates the store with the data" do
|
25
|
+
it "responds with the stub data" do
|
26
|
+
configuration = {
|
27
|
+
'stub-data' => [{
|
28
|
+
token_identifier: @test_token_identifier + 'stub',
|
29
|
+
authenticated_identifier: 'uuid321',
|
30
|
+
token_issue_time: @test_token_token_issue_time,
|
31
|
+
token_expiry_time: @test_token_expiry_time
|
32
|
+
}]
|
33
|
+
}
|
34
|
+
|
35
|
+
subject = AuthTokenStoreProvider::StubClient.new(configuration)
|
36
|
+
|
37
|
+
expect(
|
38
|
+
subject.token_exist?(
|
39
|
+
token_identifier: @test_token_identifier + 'stub',
|
40
|
+
authenticated_identifier: 'uuid321',
|
41
|
+
token_issue_time: @test_token_token_issue_time,
|
42
|
+
token_expiry_time: @test_token_expiry_time
|
43
|
+
)
|
44
|
+
).to eq true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "#add" do
|
50
|
+
context "when adding a token to the store" do
|
51
|
+
it 'responds with true' do
|
52
|
+
expect(
|
53
|
+
subject.token_exist?(
|
54
|
+
token_identifier: @test_token_identifier,
|
55
|
+
authenticated_identifier: @test_authenticated_identifier,
|
56
|
+
token_issue_time: @test_token_token_issue_time,
|
57
|
+
token_expiry_time: @test_token_expiry_time
|
58
|
+
)
|
59
|
+
).to eq false
|
60
|
+
|
61
|
+
subject.add(
|
62
|
+
token_identifier: @test_token_identifier,
|
63
|
+
authenticated_identifier: @test_authenticated_identifier,
|
64
|
+
token_issue_time: @test_token_token_issue_time,
|
65
|
+
token_expiry_time: @test_token_expiry_time
|
66
|
+
)
|
67
|
+
|
68
|
+
expect(
|
69
|
+
subject.token_exist?(
|
70
|
+
token_identifier: @test_token_identifier,
|
71
|
+
authenticated_identifier: @test_authenticated_identifier,
|
72
|
+
token_issue_time: @test_token_token_issue_time,
|
73
|
+
token_expiry_time: @test_token_expiry_time
|
74
|
+
)
|
75
|
+
).to eq true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "when unable to store a token due to an error" do
|
80
|
+
it 'responds with an error' do
|
81
|
+
expect(subject.token_exist?(
|
82
|
+
token_identifier: @test_token_identifier,
|
83
|
+
authenticated_identifier: @test_authenticated_identifier,
|
84
|
+
token_issue_time: @test_token_token_issue_time,
|
85
|
+
token_expiry_time: @test_token_expiry_time)
|
86
|
+
).to eq false
|
87
|
+
|
88
|
+
simulate_storage_failure(subject)
|
89
|
+
|
90
|
+
expect{
|
91
|
+
subject.add(token_identifier: @test_token_identifier,
|
92
|
+
authenticated_identifier: @test_authenticated_identifier,
|
93
|
+
token_issue_time: @test_token_token_issue_time,
|
94
|
+
token_expiry_time: @test_token_expiry_time
|
95
|
+
)
|
96
|
+
}.to raise_error RuntimeError, "Failure accessing store"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "#remove" do
|
103
|
+
context "Given an existing token with a unique token identifier" do
|
104
|
+
context "when the token is removed successfully" do
|
105
|
+
it "reponds with true" do
|
106
|
+
subject.add(token_identifier: @test_token_identifier,
|
107
|
+
authenticated_identifier: @test_authenticated_identifier,
|
108
|
+
token_issue_time: @test_token_token_issue_time,
|
109
|
+
token_expiry_time: @test_token_expiry_time)
|
110
|
+
|
111
|
+
expect(
|
112
|
+
subject.token_exist?(
|
113
|
+
token_identifier: @test_token_identifier,
|
114
|
+
authenticated_identifier: @test_authenticated_identifier,
|
115
|
+
token_issue_time: @test_token_token_issue_time,
|
116
|
+
token_expiry_time: @test_token_expiry_time
|
117
|
+
)
|
118
|
+
).to eq true
|
119
|
+
|
120
|
+
expect(
|
121
|
+
subject.remove(
|
122
|
+
token_identifier: @test_token_identifier
|
123
|
+
)
|
124
|
+
).to eq(true)
|
125
|
+
|
126
|
+
expect(
|
127
|
+
subject.token_exist?(
|
128
|
+
token_identifier: @test_token_identifier,
|
129
|
+
authenticated_identifier: @test_authenticated_identifier,
|
130
|
+
token_issue_time: @test_token_token_issue_time,
|
131
|
+
token_expiry_time: @test_token_expiry_time
|
132
|
+
)
|
133
|
+
).to eq false
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context "when unable to remove a token due to store error" do
|
138
|
+
it 'responds with an error' do
|
139
|
+
simulate_storage_failure(subject)
|
140
|
+
|
141
|
+
expect{
|
142
|
+
subject.remove(token_identifier: @test_token_identifier)
|
143
|
+
}.to raise_error RuntimeError, "Failure accessing store"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe "#removes_for" do
|
150
|
+
context "when all the matching tokens for the authenticated indentifier has been removed successfully from the store" do
|
151
|
+
it 'responds with true' do
|
152
|
+
subject.add(
|
153
|
+
token_identifier: @test_token_identifier,
|
154
|
+
authenticated_identifier: @test_authenticated_identifier,
|
155
|
+
token_issue_time: @test_token_token_issue_time,
|
156
|
+
token_expiry_time: @test_token_expiry_time
|
157
|
+
)
|
158
|
+
|
159
|
+
subject.add(
|
160
|
+
token_identifier: @test_token_identifier_2,
|
161
|
+
authenticated_identifier: @test_authenticated_identifier,
|
162
|
+
token_issue_time: @test_token_token_issue_time,
|
163
|
+
token_expiry_time: @test_token_expiry_time
|
164
|
+
)
|
165
|
+
|
166
|
+
expect(
|
167
|
+
subject.token_exist?(
|
168
|
+
token_identifier: @test_token_identifier,
|
169
|
+
authenticated_identifier: @test_authenticated_identifier,
|
170
|
+
token_issue_time: @test_token_token_issue_time,
|
171
|
+
token_expiry_time: @test_token_expiry_time
|
172
|
+
)
|
173
|
+
).to eq true
|
174
|
+
|
175
|
+
expect(
|
176
|
+
subject.token_exist?(
|
177
|
+
token_identifier: @test_token_identifier_2,
|
178
|
+
authenticated_identifier: @test_authenticated_identifier,
|
179
|
+
token_issue_time: @test_token_token_issue_time,
|
180
|
+
token_expiry_time: @test_token_expiry_time
|
181
|
+
)
|
182
|
+
).to eq true
|
183
|
+
|
184
|
+
expect(
|
185
|
+
subject.remove_tokens_for(
|
186
|
+
authenticated_identifier: @test_authenticated_identifier
|
187
|
+
)
|
188
|
+
).to eq(true)
|
189
|
+
|
190
|
+
expect(
|
191
|
+
subject.token_exist?(
|
192
|
+
token_identifier: @test_token_identifier,
|
193
|
+
authenticated_identifier: @test_authenticated_identifier,
|
194
|
+
token_issue_time: @test_token_token_issue_time,
|
195
|
+
token_expiry_time: @test_token_expiry_time
|
196
|
+
)
|
197
|
+
).to eq false
|
198
|
+
|
199
|
+
expect(
|
200
|
+
subject.token_exist?(
|
201
|
+
token_identifier: @test_token_identifier_2,
|
202
|
+
authenticated_identifier: @test_authenticated_identifier,
|
203
|
+
token_issue_time: @test_token_token_issue_time,
|
204
|
+
token_expiry_time: @test_token_expiry_time
|
205
|
+
)
|
206
|
+
).to eq false
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
context "When a store error occurs while trying to remove all tokens for authenticated identifier" do
|
211
|
+
it 'responds with an error' do
|
212
|
+
simulate_storage_failure(subject)
|
213
|
+
|
214
|
+
expect{
|
215
|
+
subject.remove_tokens_for(authenticated_identifier: @test_authenticated_identifier)
|
216
|
+
}.to raise_error RuntimeError, "Failure accessing store"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe "#token_exist?" do
|
222
|
+
context "when searching for a existing and persisted token" do
|
223
|
+
it "responds with true" do
|
224
|
+
subject.add(token_identifier: @test_token_identifier,
|
225
|
+
authenticated_identifier: @test_authenticated_identifier,
|
226
|
+
token_issue_time: @test_token_token_issue_time,
|
227
|
+
token_expiry_time: @test_token_expiry_time)
|
228
|
+
|
229
|
+
expect(
|
230
|
+
subject.token_exist?(
|
231
|
+
token_identifier: @test_token_identifier,
|
232
|
+
authenticated_identifier: @test_authenticated_identifier,
|
233
|
+
token_issue_time: @test_token_token_issue_time,
|
234
|
+
token_expiry_time: @test_token_expiry_time
|
235
|
+
)
|
236
|
+
).to eq true
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
|
241
|
+
context "when the token is not persisted" do
|
242
|
+
it "responds with false" do
|
243
|
+
expect(
|
244
|
+
subject.token_exist?(
|
245
|
+
token_identifier: @test_token_identifier,
|
246
|
+
authenticated_identifier: @test_authenticated_identifier,
|
247
|
+
token_issue_time: @test_token_token_issue_time,
|
248
|
+
token_expiry_time: @test_token_expiry_time
|
249
|
+
)
|
250
|
+
).to eq false
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
context "when a token (but only with some of the elements) exist in the store" do
|
255
|
+
it "responds with false" do
|
256
|
+
subject.add(
|
257
|
+
token_identifier: @test_token_identifier,
|
258
|
+
authenticated_identifier: @test_identifier_2,
|
259
|
+
token_issue_time: @test_token_token_issue_time,
|
260
|
+
token_expiry_time: @test_token_expiry_time
|
261
|
+
)
|
262
|
+
|
263
|
+
expect(
|
264
|
+
subject.token_exist?(
|
265
|
+
token_identifier: @test_token_identifier,
|
266
|
+
authenticated_identifier: @test_authenticated_identifier,
|
267
|
+
token_issue_time: @test_token_token_issue_time,
|
268
|
+
token_expiry_time: @test_token_expiry_time
|
269
|
+
)
|
270
|
+
).to eq false
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context "when unable to access the store" do
|
275
|
+
it "responds with an error" do
|
276
|
+
subject.add(
|
277
|
+
token_identifier: @test_token_identifier,
|
278
|
+
authenticated_identifier: @test_identifier,
|
279
|
+
token_issue_time: @test_token_token_issue_time,
|
280
|
+
token_expiry_time: @test_token_expiry_time
|
281
|
+
)
|
282
|
+
|
283
|
+
simulate_storage_failure(subject)
|
284
|
+
|
285
|
+
expect{
|
286
|
+
subject.token_exist?(
|
287
|
+
token_identifier: @test_token_identifier,
|
288
|
+
authenticated_identifier: @test_authenticated_identifier,
|
289
|
+
token_issue_time: @test_token_token_issue_time,
|
290
|
+
token_expiry_time: @test_token_expiry_time
|
291
|
+
)
|
292
|
+
}.to raise_error RuntimeError, "Failure accessing store"
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
describe "#list_tokens_for" do
|
298
|
+
context "when searching for the list of tokens belonging to an authenticated identifier" do
|
299
|
+
context "and there are not tokens for the authenticated identifier" do
|
300
|
+
it "responds with an empty list" do
|
301
|
+
expect(
|
302
|
+
subject.list_tokens_for(authenticated_identifier: @test_authenticated_identifier)
|
303
|
+
).to eq([])
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'should provide a list of details if there are tokens for that authenticated identifier' do
|
308
|
+
subject.add(
|
309
|
+
token_identifier: @test_token_identifier,
|
310
|
+
authenticated_identifier: @test_authenticated_identifier,
|
311
|
+
token_issue_time: @test_token_token_issue_time,
|
312
|
+
token_expiry_time: @test_token_expiry_time
|
313
|
+
)
|
314
|
+
|
315
|
+
subject.add(
|
316
|
+
token_identifier: @test_token_identifier_2,
|
317
|
+
authenticated_identifier: @test_authenticated_identifier,
|
318
|
+
token_issue_time: @test_token_token_issue_time_2,
|
319
|
+
token_expiry_time: @test_token_expiry_time
|
320
|
+
)
|
321
|
+
|
322
|
+
subject.add(
|
323
|
+
token_identifier: @test_token_identifier_2,
|
324
|
+
authenticated_identifier: @test_authenticated_identifier_2,
|
325
|
+
token_issue_time: @test_token_token_issue_time_2,
|
326
|
+
token_expiry_time: @test_token_expiry_time
|
327
|
+
)
|
328
|
+
|
329
|
+
expect(
|
330
|
+
subject.list_tokens_for(authenticated_identifier: @test_authenticated_identifier)
|
331
|
+
).to eq(
|
332
|
+
[
|
333
|
+
{
|
334
|
+
token_identifier: @test_token_identifier,
|
335
|
+
authenticated_identifier: @test_authenticated_identifier,
|
336
|
+
token_issue_time: @test_token_token_issue_time,
|
337
|
+
token_expiry_time: @test_token_expiry_time
|
338
|
+
},
|
339
|
+
{
|
340
|
+
token_identifier: @test_token_identifier_2,
|
341
|
+
authenticated_identifier: @test_authenticated_identifier,
|
342
|
+
token_issue_time: @test_token_token_issue_time_2,
|
343
|
+
token_expiry_time: @test_token_expiry_time
|
344
|
+
}
|
345
|
+
]
|
346
|
+
)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: auth_token_store_provider
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Barney de Villiers
|
8
|
+
- Tiaan van Deventer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: authenticated_client
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.0.2
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.0.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: pry
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.3'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.3'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '10.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '10.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.13'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.13'
|
84
|
+
description: Client provider library for the authentication token storage service
|
85
|
+
email:
|
86
|
+
- barney.de.villiers@hetzner.co.za
|
87
|
+
- tiaan.van.deventer@hetzner.co.za
|
88
|
+
executables:
|
89
|
+
- console
|
90
|
+
- setup
|
91
|
+
extensions: []
|
92
|
+
extra_rdoc_files: []
|
93
|
+
files:
|
94
|
+
- ".rspec"
|
95
|
+
- ".ruby-gemset"
|
96
|
+
- ".ruby-version"
|
97
|
+
- Dockerfile
|
98
|
+
- Gemfile
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- auth_token_store_provider.gemspec
|
103
|
+
- bin/console
|
104
|
+
- bin/setup
|
105
|
+
- lib/auth_token_store_provider.rb
|
106
|
+
- lib/auth_token_store_provider/client.rb
|
107
|
+
- lib/auth_token_store_provider/stub_client.rb
|
108
|
+
- lib/auth_token_store_provider/version.rb
|
109
|
+
- sanity/.ruby-gemset
|
110
|
+
- sanity/.ruby-version
|
111
|
+
- sanity/Gemfile
|
112
|
+
- sanity/sanity.rb
|
113
|
+
- spec/client_spec.rb
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
- spec/stub_client_spec.rb
|
116
|
+
homepage: https://gitlab.host-h.net/hetznerZA/authentication-token-store
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.5.1
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: Client provider library for the authentication token storage service in order
|
140
|
+
to interface with the storage programmatically
|
141
|
+
test_files:
|
142
|
+
- spec/client_spec.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
- spec/stub_client_spec.rb
|