pansophy_authenticator 0.4.3 → 0.5.0

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
- SHA1:
3
- metadata.gz: 29ebf23c67f25a00a89055ab68ba6915c1e0b856
4
- data.tar.gz: 9aff436c473c8330f468b46628b0686509f7ca13
2
+ SHA256:
3
+ metadata.gz: e14aa82153ef6d5364e11d2eca68c262b556150e045d91d69962c2851b1bbd93
4
+ data.tar.gz: 417371aabdbeeac10c8179e7afa97e7ac5e5e6e05cbc1bdd31b948f168ba9913
5
5
  SHA512:
6
- metadata.gz: 4c81c8b7374057a998df770760335dd7f1ae43abbda73aa797160611d385169b63ddba2ca72518acbc50f24aa314b46f74d1d6b869e071bf9eb853338b85d035
7
- data.tar.gz: d1945149f67d4f5d1525fe96b614266535c582ce5d014696b6dfe8e6ad90cdfdf85a46aadd70c240526baa55dcd66c02ef77cf5a4e8e22ee8bfdce934052cefb
6
+ metadata.gz: 736f3d3606bd878cfcccc5679eb5d78ae419bad4ba77519551fa7e2405ab62e01bc64d4aa50bda55bd87e2a2106f944949027e95df00f7d29ab5920782bedb21
7
+ data.tar.gz: aec2fef36ba7dc3789253715f812860192ff21470d14734bf3890e5a7616f6452f37bb05f1f5b9df4ee883246d8202b0b7db2c0c7a767975d76c79d842dcffc3
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.6.3
@@ -1,11 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1
4
- - 2.2
5
- - 2.3.0 # The version of RVM installed on Travis doesn't yet recognise 2.3 as an alias of 2.3.0
6
- before_install: gem install bundler -v 1.11.2
3
+ - 2.4
4
+ - 2.5
5
+ - 2.6
6
+ before_install:
7
+ - gem install bundler
7
8
  notifications:
8
9
  email:
9
10
  - support@travellink.com.au
10
- flowdock:
11
- secure: rn+Y1aDKALwrEUu9JkZCM+DWGMh1X3TKypx05Gh6PPut+DE+DocV1rmRZYgfU/Db0+UtCW27FpdbLETzBa/Z5r58aH0VMdWXpyYbYGXJi8Ff/nWogj0iswrmGoE8a+VEnwt2Z1Gz9LwwP/k7oxA2d+rqalGHNpTZbFf2SOIqq+S8A0ULvg+jTcG1S+mf6iCbAJLbRlRW+CC/dn5YPx9gGt/u9f/dnjGgYmkVuIzS0NvdzmB+lJfMTB4mt5Hbca9QEQSniBQFpI5neWqIBgCgqI9NvbV7s62sztjxnt2+VyjuiJG5IdClwQXIMTlvsgVGifAv99qXBH/Y7mpLUVzJr5uArLpasGe1wJI7xWBDsegYKiIZEYQGNUjFzQaBWwdS/roUWpt+I/FcCHCKYQZvx1OyzmndLN82mMzH7218N5CpCImroVWXZ6MjeOw/45RZPMAaShpdnw5NDHSNPpGF5e+MxqR7okIEoomIDsuGxDgqkCzjAbZETdWTsO8tKu3ZJnAxK9Lu5/iSsQvMLv4mUlL6EYGdjIxLwYtVzbFVVaf8AMdVsr+PMkzbHaqFcoxrE+VC/dFHVVd0szHX8DYs/Nvy5MiEVMVJxRIaUZgzim47I3r7nHKpA9fGh7ipM/pqMBTEnWC64sqQYZTWbFYQ18OyaRtqtdN3Ou3xDY+obPY=
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
5
5
 
6
+ ## [0.5.0]
7
+ ### Changed
8
+ - Simplifies verifying validity of configuration
9
+ - Use coverage kit to enforce maximum coverage
10
+ - [TT-5810] Relax runtime dependencies
11
+
6
12
  ## [0.4.3] - 2016-04-07
7
13
  ### Fixed
8
14
  - Loading of remote YAML application keys file now parses correctly
@@ -20,7 +26,7 @@ This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
20
26
  ## [0.4.0] - 2016-02-16
21
27
  ### Added
22
28
  - Implements 'application' and 'local?' helper methods
23
-
29
+
24
30
  ### Fixed
25
31
  - Tests could be influenced by system environment variables
26
32
 
@@ -11,6 +11,11 @@ module PansophyAuthenticator
11
11
  @configuration ||= configure
12
12
  end
13
13
 
14
+ def self.valid_configuration
15
+ fail Error, configuration.errors unless configuration.valid?
16
+ configuration
17
+ end
18
+
14
19
  def self.remote?
15
20
  configuration.remote?
16
21
  end
@@ -6,5 +6,7 @@ end
6
6
  require 'pansophy_authenticator/configuration/configurator'
7
7
  require 'pansophy_authenticator/configuration/from_file'
8
8
  require 'pansophy_authenticator/configuration/from_env'
9
- require 'pansophy_authenticator/configuration/instance'
10
- require 'pansophy_authenticator/configuration/verification'
9
+ require 'pansophy_authenticator/configuration/base'
10
+ require 'pansophy_authenticator/configuration/result'
11
+ require 'pansophy_authenticator/configuration/local'
12
+ require 'pansophy_authenticator/configuration/remote'
@@ -3,30 +3,29 @@ require 'memoizable'
3
3
 
4
4
  module PansophyAuthenticator
5
5
  module Configuration
6
- class Instance
7
- include Anima.new :local, :bucket_name, :file_path, :application, :cache_store
6
+ class Base
7
+ include Anima.new :bucket_name, :file_path, :application, :cache_store
8
8
  include Memoizable
9
9
 
10
10
  def local?
11
- @local
11
+ false
12
12
  end
13
13
 
14
14
  def remote?
15
15
  !local?
16
16
  end
17
17
 
18
- def valid?
19
- verification.valid?
20
- end
21
-
22
18
  def errors
23
- verification.errors
19
+ return ['Application is not defined'] if @application.nil?
20
+ []
24
21
  end
25
22
 
26
- private
23
+ def valid?
24
+ verification.valid?
25
+ end
27
26
 
28
27
  def verification
29
- Verification::Verify.new(self).call
28
+ Result.new errors
30
29
  end
31
30
  memoize :verification
32
31
  end
@@ -15,31 +15,35 @@ module PansophyAuthenticator
15
15
  private
16
16
 
17
17
  def build_configuration
18
- Instance.new(
19
- local: config_values.local,
18
+ attrs = {
20
19
  bucket_name: config_values.bucket_name,
21
20
  file_path: config_values.file_path,
22
21
  application: config_values.application,
23
22
  cache_store: cache_store
24
- )
23
+ }
24
+ if config_values.local
25
+ Local.new(attrs)
26
+ else
27
+ Remote.new(attrs)
28
+ end
25
29
  end
26
30
 
27
31
  def config_values
28
- @config_values ||= from_env
32
+ @config_values ||= from_env_or_base
33
+ end
34
+
35
+ def from_env_or_base
36
+ FromEnv.new(base_config)
29
37
  end
30
38
 
31
39
  def base_config
32
40
  return self if @configuration_path.nil?
33
- from_file
41
+ from_file_or_base
34
42
  end
35
43
 
36
- def from_file
44
+ def from_file_or_base
37
45
  FromFile.new(self)
38
46
  end
39
-
40
- def from_env
41
- FromEnv.new(base_config)
42
- end
43
47
  end
44
48
  end
45
49
  end
@@ -0,0 +1,26 @@
1
+ module PansophyAuthenticator
2
+ module Configuration
3
+ class Local < Base
4
+ def errors
5
+ errors = super
6
+ return errors + ['File path is not defined'] unless file_path?
7
+ return errors + ["#{@file_path} does not exist"] unless file_exist?
8
+ errors
9
+ end
10
+
11
+ def local?
12
+ true
13
+ end
14
+
15
+ private
16
+
17
+ def file_path?
18
+ !@file_path.nil?
19
+ end
20
+
21
+ def file_exist?
22
+ File.exist? @file_path
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ module PansophyAuthenticator
2
+ module Configuration
3
+ class Remote < Base
4
+ def errors
5
+ errors = super
6
+ return errors + ['Bucket name is not defined'] if @bucket_name.nil?
7
+ return errors + ['File path is not defined'] if @file_path.nil?
8
+ errors
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module PansophyAuthenticator
2
+ module Configuration
3
+ class Result
4
+ include Adamantium
5
+
6
+ attr_reader :errors
7
+
8
+ def initialize(errors = [])
9
+ @errors = Array(errors)
10
+ end
11
+
12
+ def valid?
13
+ @errors.empty?
14
+ end
15
+ end
16
+ end
17
+ end
@@ -26,7 +26,7 @@ module PansophyAuthenticator
26
26
  end
27
27
 
28
28
  def configuration
29
- PansophyAuthenticator.configuration
29
+ PansophyAuthenticator.valid_configuration
30
30
  end
31
31
  end
32
32
  end
@@ -29,7 +29,7 @@ module PansophyAuthenticator
29
29
  end
30
30
 
31
31
  def configuration
32
- PansophyAuthenticator.configuration
32
+ PansophyAuthenticator.valid_configuration
33
33
  end
34
34
 
35
35
  def fail_for_invalid_format!
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module PansophyAuthenticator
3
- VERSION = '0.4.3'.freeze
4
+ VERSION = '0.5.0'
4
5
  end
@@ -24,21 +24,21 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.required_ruby_version = '>= 2.1'
27
+ spec.required_ruby_version = '>= 2.4'
28
28
 
29
- spec.add_dependency 'memoizable', '~> 0.4'
30
- spec.add_dependency 'anima', '~> 0.3'
31
- spec.add_dependency 'adamantium', '~> 0.2'
32
- spec.add_dependency 'pansophy', '~> 0.5', '>= 0.5.2'
33
- spec.add_dependency 'yamload', '~> 0.2'
29
+ spec.add_dependency 'memoizable'
30
+ spec.add_dependency 'anima'
31
+ spec.add_dependency 'adamantium'
32
+ spec.add_dependency 'pansophy'
33
+ spec.add_dependency 'yamload'
34
34
 
35
- spec.add_development_dependency 'bundler', '~> 1.11'
36
- spec.add_development_dependency 'rake', '~> 10.0'
37
- spec.add_development_dependency 'rspec', '~> 3.4'
38
- spec.add_development_dependency 'timecop', '~> 0.8'
39
- spec.add_development_dependency 'simplecov', '~> 0.11'
40
- spec.add_development_dependency 'simplecov-rcov', '~> 0.2'
41
- spec.add_development_dependency 'coveralls', '~> 0.8'
42
- spec.add_development_dependency 'rubocop', '~> 0.39'
43
- spec.add_development_dependency 'travis', '~> 1.8'
35
+ spec.add_development_dependency 'bundler'
36
+ spec.add_development_dependency 'rake'
37
+ spec.add_development_dependency 'rspec'
38
+ spec.add_development_dependency 'timecop'
39
+ spec.add_development_dependency 'coverage-kit'
40
+ spec.add_development_dependency 'simplecov-rcov'
41
+ spec.add_development_dependency 'coveralls'
42
+ spec.add_development_dependency "rubocop", ">= 0.49.0" # CVE-2017-8418
43
+ spec.add_development_dependency 'travis'
44
44
  end
metadata CHANGED
@@ -1,217 +1,211 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pansophy_authenticator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Berardi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-07 00:00:00.000000000 Z
11
+ date: 2019-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memoizable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.4'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.4'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: anima
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.3'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: adamantium
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.2'
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.2'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pansophy
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.5'
62
59
  - - ">="
63
60
  - !ruby/object:Gem::Version
64
- version: 0.5.2
61
+ version: '0'
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '0.5'
72
66
  - - ">="
73
67
  - !ruby/object:Gem::Version
74
- version: 0.5.2
68
+ version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: yamload
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - "~>"
73
+ - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '0.2'
75
+ version: '0'
82
76
  type: :runtime
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
- - - "~>"
80
+ - - ">="
87
81
  - !ruby/object:Gem::Version
88
- version: '0.2'
82
+ version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: bundler
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
- - - "~>"
87
+ - - ">="
94
88
  - !ruby/object:Gem::Version
95
- version: '1.11'
89
+ version: '0'
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
- - - "~>"
94
+ - - ">="
101
95
  - !ruby/object:Gem::Version
102
- version: '1.11'
96
+ version: '0'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: rake
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
- - - "~>"
101
+ - - ">="
108
102
  - !ruby/object:Gem::Version
109
- version: '10.0'
103
+ version: '0'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
- - - "~>"
108
+ - - ">="
115
109
  - !ruby/object:Gem::Version
116
- version: '10.0'
110
+ version: '0'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: rspec
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
- - - "~>"
115
+ - - ">="
122
116
  - !ruby/object:Gem::Version
123
- version: '3.4'
117
+ version: '0'
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
- - - "~>"
122
+ - - ">="
129
123
  - !ruby/object:Gem::Version
130
- version: '3.4'
124
+ version: '0'
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: timecop
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
- - - "~>"
129
+ - - ">="
136
130
  - !ruby/object:Gem::Version
137
- version: '0.8'
131
+ version: '0'
138
132
  type: :development
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
- - - "~>"
136
+ - - ">="
143
137
  - !ruby/object:Gem::Version
144
- version: '0.8'
138
+ version: '0'
145
139
  - !ruby/object:Gem::Dependency
146
- name: simplecov
140
+ name: coverage-kit
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
- - - "~>"
143
+ - - ">="
150
144
  - !ruby/object:Gem::Version
151
- version: '0.11'
145
+ version: '0'
152
146
  type: :development
153
147
  prerelease: false
154
148
  version_requirements: !ruby/object:Gem::Requirement
155
149
  requirements:
156
- - - "~>"
150
+ - - ">="
157
151
  - !ruby/object:Gem::Version
158
- version: '0.11'
152
+ version: '0'
159
153
  - !ruby/object:Gem::Dependency
160
154
  name: simplecov-rcov
161
155
  requirement: !ruby/object:Gem::Requirement
162
156
  requirements:
163
- - - "~>"
157
+ - - ">="
164
158
  - !ruby/object:Gem::Version
165
- version: '0.2'
159
+ version: '0'
166
160
  type: :development
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
163
  requirements:
170
- - - "~>"
164
+ - - ">="
171
165
  - !ruby/object:Gem::Version
172
- version: '0.2'
166
+ version: '0'
173
167
  - !ruby/object:Gem::Dependency
174
168
  name: coveralls
175
169
  requirement: !ruby/object:Gem::Requirement
176
170
  requirements:
177
- - - "~>"
171
+ - - ">="
178
172
  - !ruby/object:Gem::Version
179
- version: '0.8'
173
+ version: '0'
180
174
  type: :development
181
175
  prerelease: false
182
176
  version_requirements: !ruby/object:Gem::Requirement
183
177
  requirements:
184
- - - "~>"
178
+ - - ">="
185
179
  - !ruby/object:Gem::Version
186
- version: '0.8'
180
+ version: '0'
187
181
  - !ruby/object:Gem::Dependency
188
182
  name: rubocop
189
183
  requirement: !ruby/object:Gem::Requirement
190
184
  requirements:
191
- - - "~>"
185
+ - - ">="
192
186
  - !ruby/object:Gem::Version
193
- version: '0.39'
187
+ version: 0.49.0
194
188
  type: :development
195
189
  prerelease: false
196
190
  version_requirements: !ruby/object:Gem::Requirement
197
191
  requirements:
198
- - - "~>"
192
+ - - ">="
199
193
  - !ruby/object:Gem::Version
200
- version: '0.39'
194
+ version: 0.49.0
201
195
  - !ruby/object:Gem::Dependency
202
196
  name: travis
203
197
  requirement: !ruby/object:Gem::Requirement
204
198
  requirements:
205
- - - "~>"
199
+ - - ">="
206
200
  - !ruby/object:Gem::Version
207
- version: '1.8'
201
+ version: '0'
208
202
  type: :development
209
203
  prerelease: false
210
204
  version_requirements: !ruby/object:Gem::Requirement
211
205
  requirements:
212
- - - "~>"
206
+ - - ">="
213
207
  - !ruby/object:Gem::Version
214
- version: '1.8'
208
+ version: '0'
215
209
  description: By configuring a set of applications authentication keys in a filestored
216
210
  in an S3 bucket, applications can authenticate with each otherby submitting their
217
211
  authentication key, which the receiver can matchagainst the key stored in S3.S3
@@ -240,16 +234,13 @@ files:
240
234
  - lib/pansophy_authenticator/cache.rb
241
235
  - lib/pansophy_authenticator/cache_stores/memory.rb
242
236
  - lib/pansophy_authenticator/configuration.rb
237
+ - lib/pansophy_authenticator/configuration/base.rb
243
238
  - lib/pansophy_authenticator/configuration/configurator.rb
244
239
  - lib/pansophy_authenticator/configuration/from_env.rb
245
240
  - lib/pansophy_authenticator/configuration/from_file.rb
246
- - lib/pansophy_authenticator/configuration/instance.rb
247
- - lib/pansophy_authenticator/configuration/verification.rb
248
- - lib/pansophy_authenticator/configuration/verification/common.rb
249
- - lib/pansophy_authenticator/configuration/verification/local.rb
250
- - lib/pansophy_authenticator/configuration/verification/remote.rb
251
- - lib/pansophy_authenticator/configuration/verification/result.rb
252
- - lib/pansophy_authenticator/configuration/verification/verify.rb
241
+ - lib/pansophy_authenticator/configuration/local.rb
242
+ - lib/pansophy_authenticator/configuration/remote.rb
243
+ - lib/pansophy_authenticator/configuration/result.rb
253
244
  - lib/pansophy_authenticator/local.rb
254
245
  - lib/pansophy_authenticator/local/build_loader.rb
255
246
  - lib/pansophy_authenticator/local/fetcher.rb
@@ -270,15 +261,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
261
  requirements:
271
262
  - - ">="
272
263
  - !ruby/object:Gem::Version
273
- version: '2.1'
264
+ version: '2.4'
274
265
  required_rubygems_version: !ruby/object:Gem::Requirement
275
266
  requirements:
276
267
  - - ">="
277
268
  - !ruby/object:Gem::Version
278
269
  version: '0'
279
270
  requirements: []
280
- rubyforge_project:
281
- rubygems_version: 2.5.1
271
+ rubygems_version: 3.0.3
282
272
  signing_key:
283
273
  specification_version: 4
284
274
  summary: Inter application authentication via central authority
@@ -1,12 +0,0 @@
1
- module PansophyAuthenticator
2
- module Configuration
3
- module Verification
4
- end
5
- end
6
- end
7
-
8
- require 'pansophy_authenticator/configuration/verification/result'
9
- require 'pansophy_authenticator/configuration/verification/common'
10
- require 'pansophy_authenticator/configuration/verification/local'
11
- require 'pansophy_authenticator/configuration/verification/remote'
12
- require 'pansophy_authenticator/configuration/verification/verify'
@@ -1,16 +0,0 @@
1
- module PansophyAuthenticator
2
- module Configuration
3
- module Verification
4
- class Common
5
- def initialize(configuration)
6
- @configuration = configuration
7
- end
8
-
9
- def verify
10
- return Result.new 'Application is not defined' if @configuration.application.nil?
11
- Result.new
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,35 +0,0 @@
1
- module PansophyAuthenticator
2
- module Configuration
3
- module Verification
4
- class Local
5
- def initialize(configuration)
6
- @configuration = configuration
7
- end
8
-
9
- def verify
10
- Result.new errors
11
- end
12
-
13
- private
14
-
15
- def errors
16
- return ['File path is not defined'] unless file_path?
17
- return ["#{file_path} does not exist"] unless file_exist?
18
- []
19
- end
20
-
21
- def file_path?
22
- !file_path.nil?
23
- end
24
-
25
- def file_exist?
26
- File.exist? file_path
27
- end
28
-
29
- def file_path
30
- @configuration.file_path
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,19 +0,0 @@
1
- module PansophyAuthenticator
2
- module Configuration
3
- module Verification
4
- class Remote
5
- def initialize(configuration)
6
- @configuration = configuration
7
- @result = Result.new
8
- end
9
-
10
- def verify
11
- errors = []
12
- errors << 'Bucket name is not defined' if @configuration.bucket_name.nil?
13
- errors << 'File path is not defined' if @configuration.file_path.nil?
14
- Result.new errors
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,25 +0,0 @@
1
- module PansophyAuthenticator
2
- module Configuration
3
- module Verification
4
- class Result
5
- include Adamantium
6
-
7
- attr_reader :errors
8
-
9
- def initialize(errors = [])
10
- @errors = Array(errors)
11
- end
12
-
13
- def valid?
14
- @errors.empty?
15
- end
16
-
17
- def +(other)
18
- transform do
19
- @errors += other.errors
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,29 +0,0 @@
1
- module PansophyAuthenticator
2
- module Configuration
3
- module Verification
4
- class Verify
5
- def initialize(configuration)
6
- @configuration = configuration
7
- end
8
-
9
- def call
10
- verifiers.map { |verifier| verifier.new(@configuration).verify }.reduce(&:+)
11
- end
12
-
13
- private
14
-
15
- def verifiers
16
- [Common, specific_verifier]
17
- end
18
-
19
- def specific_verifier
20
- if @configuration.local?
21
- Local
22
- else
23
- Remote
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end