wm_okta_helper 0.2.9 → 0.2.10

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: 93d0540f752bd3f700c36d97fb558fff539e516d
4
- data.tar.gz: 4e9a214fd7554a5a5d0ec505b2f70ca41764d680
3
+ metadata.gz: c2d5eb3470b1a00674d3e3650affacd7bb45cfc6
4
+ data.tar.gz: a80adf08b3cf547d673f301024e06047e1fd1e08
5
5
  SHA512:
6
- metadata.gz: ced3fb0aa135b923a7b7f3a595afc7de214c0c05cce72dd7282bb1baaa151165e9c7911bed070de5ef3f91b049ee8012e5d4fa89fc543f7d78c9368c63f91e6d
7
- data.tar.gz: 916eeb7bb508380af2e155c03c91496ded205ca309d27883f731691bd5bdf9f2a665bdfbb81f3b89324ccaf7f2e3634492d58bb2d75c6cf3a18da3bd8774c6f4
6
+ metadata.gz: 46f0f5b180e62d59b60875751997c899714ee5ccf1f87ef111ff603aa2ce7a9262fe4258e729cbe9c65eea1b00f9f49f3116c59a55d069ee14f73d004709dcd9
7
+ data.tar.gz: e37346acf549d7dea339c723ee8dd3ae1a8053dfa1bb532d236ceab3744ee339078b490cf8d8e14bbf9834a2bf0fd9ab7eea46af418003545e8d6aecb7db06dd
@@ -17,6 +17,9 @@ jobs:
17
17
  - run:
18
18
  name: install dependencies
19
19
  command: |
20
+ echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
21
+ source $BASH_ENV
22
+ gem install bundler
20
23
  bundle install --jobs=4 --retry=3 --path vendor/bundle
21
24
 
22
25
  - run:
@@ -6,8 +6,7 @@ AllCops:
6
6
  TargetRubyVersion: 2.5.1
7
7
  Exclude:
8
8
  - "vendor/**/*"
9
- - "db/schema.rb"
10
- - "node_modules/**/*"
9
+ - "wm_okta_helper.gemspec"
11
10
  - bin/*
12
11
  Layout/DotPosition:
13
12
  Description: Checks the position of the dot in multi-line method calls.
@@ -49,3 +48,247 @@ Rails/DynamicFindBy:
49
48
  Style/Documentation:
50
49
  Description: Document classes and non-namespace modules.
51
50
  Enabled: false
51
+
52
+
53
+
54
+ Layout/DotPosition:
55
+ Description: Checks the position of the dot in multi-line method calls.
56
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
57
+ Enabled: true
58
+ EnforcedStyle: leading
59
+ SupportedStyles:
60
+ - leading
61
+ - trailing
62
+ Layout/EmptyLineAfterMagicComment:
63
+ Description: 'Add an empty line after magic comments to separate them from code.'
64
+ StyleGuide: '#separate-magic-comments-from-code'
65
+ Enabled: false
66
+ Lint/AmbiguousBlockAssociation:
67
+ Exclude:
68
+ - "spec/**/*"
69
+ Style/CollectionMethods:
70
+ Description: Preferred collection methods.
71
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
72
+ Enabled: true
73
+ PreferredMethods:
74
+ collect: map
75
+ collect!: map!
76
+ find: detect
77
+ find_all: select
78
+ reduce: inject
79
+ Naming/FileName:
80
+ Description: Use snake_case for source file names.
81
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
82
+ Enabled: false
83
+ Exclude: []
84
+ Style/GuardClause:
85
+ Description: Check for conditionals that can be replaced with guard clauses
86
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
87
+ Enabled: false
88
+ MinBodyLength: 1
89
+ Style/IfUnlessModifier:
90
+ Description: Favor modifier if/unless usage when you have a single-line body.
91
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
92
+ Enabled: false
93
+ Style/OptionHash:
94
+ Description: Don't use option hashes when you can use keyword arguments.
95
+ Enabled: false
96
+ Style/PercentLiteralDelimiters:
97
+ Description: Use `%`-literal delimiters consistently
98
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
99
+ Enabled: false
100
+ PreferredDelimiters:
101
+ "%": "()"
102
+ "%i": "()"
103
+ "%q": "()"
104
+ "%Q": "()"
105
+ "%r": "{}"
106
+ "%s": "()"
107
+ "%w": "()"
108
+ "%W": "()"
109
+ "%x": "()"
110
+ Naming/PredicateName:
111
+ Description: Check the names of predicate methods.
112
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
113
+ Enabled: true
114
+ NamePrefix:
115
+ - is_
116
+ - has_
117
+ - have_
118
+ NamePrefixBlacklist:
119
+ - is_
120
+ Exclude:
121
+ - spec/**/*
122
+ Style/RaiseArgs:
123
+ Description: Checks the arguments passed to raise/fail.
124
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
125
+ Enabled: false
126
+ EnforcedStyle: exploded
127
+ SupportedStyles:
128
+ - compact
129
+ - exploded
130
+ Style/SignalException:
131
+ Description: Checks for proper usage of fail and raise.
132
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
133
+ Enabled: true
134
+ EnforcedStyle: semantic
135
+ SupportedStyles:
136
+ - only_raise
137
+ - only_fail
138
+ - semantic
139
+ Style/SingleLineBlockParams:
140
+ Description: Enforces the names of some block params.
141
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
142
+ Enabled: false
143
+ Methods:
144
+ - reduce:
145
+ - a
146
+ - e
147
+ - inject:
148
+ - a
149
+ - e
150
+ Style/SingleLineMethods:
151
+ Description: Avoid single-line methods.
152
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
153
+ Enabled: false
154
+ AllowIfMethodIsEmpty: true
155
+ Style/StringLiterals:
156
+ Description: Checks if uses of quotes match the configured preference.
157
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
158
+ Enabled: true
159
+ EnforcedStyle: single_quotes
160
+ SupportedStyles:
161
+ - single_quotes
162
+ - double_quotes
163
+ Style/StringLiteralsInInterpolation:
164
+ Description: Checks if uses of quotes inside expressions in interpolated strings
165
+ match the configured preference.
166
+ Enabled: true
167
+ EnforcedStyle: single_quotes
168
+ SupportedStyles:
169
+ - single_quotes
170
+ - double_quotes
171
+ Style/TrailingCommaInArguments:
172
+ Description: 'Checks for trailing comma in argument lists.'
173
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
174
+ Enabled: true
175
+ EnforcedStyleForMultiline: no_comma
176
+ Style/TrailingCommaInArrayLiteral:
177
+ Description: 'Checks for trailing comma in array literals.'
178
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
179
+ Enabled: true
180
+ EnforcedStyleForMultiline: no_comma
181
+ Style/TrailingCommaInHashLiteral:
182
+ Description: 'Checks for trailing comma in hash literals.'
183
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
184
+ Enabled: true
185
+ EnforcedStyleForMultiline: no_comma
186
+ Metrics/AbcSize:
187
+ Description: A calculated magnitude based on number of assignments, branches, and
188
+ conditions.
189
+ Enabled: false
190
+ Max: 15
191
+ Metrics/ClassLength:
192
+ Description: Avoid classes longer than 100 lines of code.
193
+ Enabled: false
194
+ CountComments: false
195
+ Max: 100
196
+ Metrics/ModuleLength:
197
+ CountComments: false
198
+ Max: 100
199
+ Description: Avoid modules longer than 100 lines of code.
200
+ Enabled: false
201
+ Metrics/CyclomaticComplexity:
202
+ Description: A complexity metric that is strongly correlated to the number of test
203
+ cases needed to validate a method.
204
+ Enabled: false
205
+ Max: 6
206
+ Metrics/MethodLength:
207
+ Description: Avoid methods longer than 10 lines of code.
208
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
209
+ Enabled: false
210
+ CountComments: false
211
+ Max: 10
212
+ Metrics/ParameterLists:
213
+ Description: Avoid parameter lists longer than three or four parameters.
214
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
215
+ Enabled: false
216
+ Max: 5
217
+ CountKeywordArgs: true
218
+ Metrics/PerceivedComplexity:
219
+ Description: A complexity metric geared towards measuring complexity for a human
220
+ reader.
221
+ Enabled: false
222
+ Max: 7
223
+ Lint/AssignmentInCondition:
224
+ Description: Don't use assignment in conditions.
225
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
226
+ Enabled: false
227
+ AllowSafeAssignment: true
228
+ Style/InlineComment:
229
+ Description: Avoid inline comments.
230
+ Enabled: false
231
+ Naming/AccessorMethodName:
232
+ Description: Check the naming of accessor methods for get_/set_.
233
+ Enabled: false
234
+ Style/Alias:
235
+ Description: Use alias_method instead of alias.
236
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
237
+ Enabled: false
238
+ Style/Documentation:
239
+ Description: Document classes and non-namespace modules.
240
+ Enabled: false
241
+ Style/DoubleNegation:
242
+ Description: Checks for uses of double negation (!!).
243
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
244
+ Enabled: false
245
+ Style/EachWithObject:
246
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
247
+ Enabled: false
248
+ Style/EmptyLiteral:
249
+ Description: Prefer literals to Array.new/Hash.new/String.new.
250
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
251
+ Enabled: false
252
+ Style/ModuleFunction:
253
+ Description: Checks for usage of `extend self` in modules.
254
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
255
+ Enabled: false
256
+ Style/OneLineConditional:
257
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
258
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
259
+ Enabled: false
260
+ Style/PerlBackrefs:
261
+ Description: Avoid Perl-style regex back references.
262
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
263
+ Enabled: false
264
+ Style/Send:
265
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
266
+ may overlap with existing methods.
267
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
268
+ Enabled: false
269
+ Style/SpecialGlobalVars:
270
+ Description: Avoid Perl-style global variables.
271
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
272
+ Enabled: false
273
+ Style/VariableInterpolation:
274
+ Description: Don't interpolate global, instance and class variables directly in
275
+ strings.
276
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
277
+ Enabled: false
278
+ Style/WhenThen:
279
+ Description: Use when x then ... for one-line cases.
280
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
281
+ Enabled: false
282
+ Lint/EachWithObjectArgument:
283
+ Description: Check for immutable argument given to each_with_object.
284
+ Enabled: true
285
+ Lint/HandleExceptions:
286
+ Description: Don't suppress exception.
287
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
288
+ Enabled: false
289
+ Lint/LiteralAsCondition:
290
+ Description: Checks of literals used in conditions.
291
+ Enabled: false
292
+ Lint/LiteralInInterpolation:
293
+ Description: Checks for literals used in interpolation.
294
+ Enabled: false
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wm_okta_helper (0.2.8)
4
+ wm_okta_helper (0.2.10)
5
5
  json-jwt
6
6
  jwt
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (5.2.4)
11
+ activesupport (5.2.4.1)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 0.7, < 2)
14
14
  minitest (~> 5.1)
@@ -26,7 +26,7 @@ GEM
26
26
  diff-lcs (1.3)
27
27
  docile (1.3.1)
28
28
  hashdiff (0.3.7)
29
- i18n (1.7.0)
29
+ i18n (1.8.2)
30
30
  concurrent-ruby (~> 1.0)
31
31
  json (2.1.0)
32
32
  json-jwt (1.11.0)
@@ -35,7 +35,7 @@ GEM
35
35
  bindata
36
36
  jwt (2.2.1)
37
37
  method_source (0.9.0)
38
- minitest (5.13.0)
38
+ minitest (5.14.0)
39
39
  parallel (1.12.1)
40
40
  parser (2.5.1.2)
41
41
  ast (~> 2.4.0)
@@ -80,7 +80,7 @@ GEM
80
80
  simplecov-html (0.10.2)
81
81
  thread_safe (0.3.6)
82
82
  timecop (0.9.1)
83
- tzinfo (1.2.5)
83
+ tzinfo (1.2.6)
84
84
  thread_safe (~> 0.1)
85
85
  unicode-display_width (1.4.0)
86
86
  webmock (3.4.2)
@@ -92,7 +92,7 @@ PLATFORMS
92
92
  ruby
93
93
 
94
94
  DEPENDENCIES
95
- bundler (~> 1.16.6)
95
+ bundler (~> 2.1.4)
96
96
  pry-byebug
97
97
  rake (~> 10.0)
98
98
  rspec (~> 3.0)
@@ -104,4 +104,4 @@ DEPENDENCIES
104
104
  wm_okta_helper!
105
105
 
106
106
  BUNDLED WITH
107
- 1.16.6
107
+ 2.1.4
@@ -12,6 +12,7 @@ module WmOktaHelper
12
12
  @okta_org = options[:okta_org]
13
13
  @okta_domain = options[:okta_domain]
14
14
  @okta_client_id = options[:okta_client_id]
15
+ @ignore_validations = options[:ignore_validations] || false
15
16
  end
16
17
 
17
18
  def call
@@ -60,6 +61,12 @@ module WmOktaHelper
60
61
 
61
62
  def parse_token
62
63
  JSON::JWT.decode request_token, public_key
64
+ rescue JWT::ExpiredSignature => e
65
+ if @ignore_validations
66
+ JSON::JWT.decode request_token, :skip_verification
67
+ else
68
+ raise e
69
+ end
63
70
  rescue StandardError
64
71
  JSON::JWT.decode request_token, public_key(true)
65
72
  end
@@ -75,13 +82,11 @@ module WmOktaHelper
75
82
 
76
83
  def token_valid?
77
84
  @token = parse_token
78
- if @token['iss'] != site ||
79
- @token['aud'] != client_id ||
80
- @token['exp'].to_i < Time.now.utc.to_i
81
- return false
82
- else
83
- return true
84
- end
85
+ @ignore_validations || (
86
+ @token['iss'] == site &&
87
+ @token['aud'] == client_id &&
88
+ @token['exp'].to_i >= Time.now.utc.to_i
89
+ )
85
90
  end
86
91
  end
87
92
  end
@@ -8,7 +8,7 @@ module WmOktaHelper
8
8
 
9
9
  def call
10
10
  check_options
11
- raise 'Not authorized' if response['sessionToken'].blank?
11
+ fail 'Not authorized' if response['sessionToken'].blank?
12
12
  response
13
13
  end
14
14
 
@@ -23,7 +23,7 @@ module WmOktaHelper
23
23
  def check_options
24
24
  missing_options = available_options.select { |o| @options[o].blank? }
25
25
  if missing_options.present?
26
- raise "Missing configuration variable: #{missing_options}"
26
+ fail "Missing configuration variable: #{missing_options}"
27
27
  end
28
28
  available_options.each do |o|
29
29
  instance_variable_set("@#{o}", @options[o])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WmOktaHelper
4
- VERSION = '0.2.9'
4
+ VERSION = '0.2.10'
5
5
  end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency 'json-jwt'
37
37
  spec.add_dependency 'jwt'
38
38
 
39
- spec.add_development_dependency 'bundler', '~> 1.16.6'
39
+ spec.add_development_dependency 'bundler', '~> 2.1.4'
40
40
  spec.add_development_dependency 'pry-byebug'
41
41
  spec.add_development_dependency 'rake', '~> 10.0'
42
42
  spec.add_development_dependency 'rspec', '~> 3.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wm_okta_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose C Fernandez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-20 00:00:00.000000000 Z
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-jwt
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.16.6
47
+ version: 2.1.4
48
48
  type: :development
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: 1.16.6
54
+ version: 2.1.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry-byebug
57
57
  requirement: !ruby/object:Gem::Requirement