omniauth-azure-adv2 0.0.5

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c01bc74ef8708f52af790e5a608ff865005e2cb9
4
+ data.tar.gz: 2eb048ac0e0be1ed3cdf23de4b6684360fac3225
5
+ SHA512:
6
+ metadata.gz: 421d570e536537654bb25347ad585847534c3e3a7c569686b6b7a14367284ccbd7e14276bf3f311c9a7f8b52dd30359c1e45be5a5199427327ba474562aeb064
7
+ data.tar.gz: 280839f6a740acebe0ad8b267fd6dcfc986b92a638017dcd50c74244949f63f8f80a11e9116e3f06e1b8c714b4d993ae6eedd7876dc3651e2f5ea4f99a6582d8
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,562 @@
1
+ Style/AccessorMethodName:
2
+ Description: Check the naming of accessor methods for get_/set_.
3
+ Enabled: false
4
+
5
+ Style/Alias:
6
+ Description: 'Use alias_method instead of alias.'
7
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
8
+ Enabled: false
9
+
10
+ Style/ArrayJoin:
11
+ Description: 'Use Array#join instead of Array#*.'
12
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
13
+ Enabled: false
14
+
15
+ Style/AsciiComments:
16
+ Description: 'Use only ascii symbols in comments.'
17
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
18
+ Enabled: false
19
+
20
+ Style/AsciiIdentifiers:
21
+ Description: 'Use only ascii symbols in identifiers.'
22
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
23
+ Enabled: false
24
+
25
+ Style/Attr:
26
+ Description: 'Checks for uses of Module#attr.'
27
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
28
+ Enabled: false
29
+
30
+ Metrics/BlockNesting:
31
+ Description: 'Avoid excessive block nesting'
32
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
33
+ Enabled: false
34
+
35
+ Style/CaseEquality:
36
+ Description: 'Avoid explicit use of the case equality operator(===).'
37
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
38
+ Enabled: false
39
+
40
+ Style/CharacterLiteral:
41
+ Description: 'Checks for uses of character literals.'
42
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
43
+ Enabled: false
44
+
45
+ Style/ClassAndModuleChildren:
46
+ Description: 'Checks style of children classes and modules.'
47
+ Enabled: true
48
+ EnforcedStyle: nested
49
+
50
+ Style/FrozenStringLiteralComment:
51
+ Enabled: false
52
+
53
+ Metrics/ClassLength:
54
+ Description: 'Avoid classes longer than 100 lines of code.'
55
+ Enabled: false
56
+
57
+ Metrics/ModuleLength:
58
+ Description: 'Avoid modules longer than 100 lines of code.'
59
+ Enabled: false
60
+
61
+ Style/ClassVars:
62
+ Description: 'Avoid the use of class variables.'
63
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
64
+ Enabled: false
65
+
66
+ Style/CollectionMethods:
67
+ Enabled: true
68
+ PreferredMethods:
69
+ find: detect
70
+ inject: reduce
71
+ collect: map
72
+ find_all: select
73
+
74
+ Style/ColonMethodCall:
75
+ Description: 'Do not use :: for method call.'
76
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
77
+ Enabled: false
78
+
79
+ Style/CommentAnnotation:
80
+ Description: >-
81
+ Checks formatting of special comments
82
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
83
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
84
+ Enabled: false
85
+
86
+ Metrics/AbcSize:
87
+ Description: >-
88
+ A calculated magnitude based on number of assignments,
89
+ branches, and conditions.
90
+ Enabled: false
91
+
92
+ Metrics/CyclomaticComplexity:
93
+ Description: >-
94
+ A complexity metric that is strongly correlated to the number
95
+ of test cases needed to validate a method.
96
+ Enabled: false
97
+
98
+ Style/PreferredHashMethods:
99
+ Description: 'Checks for use of deprecated Hash methods.'
100
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
101
+ Enabled: false
102
+
103
+ Style/Documentation:
104
+ Description: 'Document classes and non-namespace modules.'
105
+ Enabled: false
106
+
107
+ Style/DotPosition:
108
+ Description: 'Checks the position of the dot in multi-line method calls.'
109
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
110
+ EnforcedStyle: trailing
111
+
112
+ Style/DoubleNegation:
113
+ Description: 'Checks for uses of double negation (!!).'
114
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
115
+ Enabled: false
116
+
117
+ Style/EachWithObject:
118
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
119
+ Enabled: false
120
+
121
+ Style/EmptyLiteral:
122
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
123
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
124
+ Enabled: false
125
+
126
+ # Checks whether the source file has a utf-8 encoding comment or not
127
+ # AutoCorrectEncodingComment must match the regex
128
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
129
+ Style/Encoding:
130
+ Enabled: false
131
+
132
+ Style/EvenOdd:
133
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
134
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
135
+ Enabled: false
136
+
137
+ Style/ExtraSpacing:
138
+ Description: 'Do not use unnecessary spacing.'
139
+ Enabled: true
140
+
141
+ Style/FileName:
142
+ Description: 'Use snake_case for source file names.'
143
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
144
+ Enabled: false
145
+
146
+ Style/FlipFlop:
147
+ Description: 'Checks for flip flops'
148
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
149
+ Enabled: false
150
+
151
+ Style/FormatString:
152
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
153
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
154
+ Enabled: false
155
+
156
+ Style/GlobalVars:
157
+ Description: 'Do not introduce global variables.'
158
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
159
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
160
+ Enabled: false
161
+
162
+ Style/GuardClause:
163
+ Description: 'Check for conditionals that can be replaced with guard clauses'
164
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
165
+ Enabled: false
166
+
167
+ Style/IfUnlessModifier:
168
+ Description: >-
169
+ Favor modifier if/unless usage when you have a
170
+ single-line body.
171
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
172
+ Enabled: false
173
+
174
+ Style/IfWithSemicolon:
175
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
176
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
177
+ Enabled: false
178
+
179
+ Style/InlineComment:
180
+ Description: 'Avoid inline comments.'
181
+ Enabled: false
182
+
183
+ Style/Lambda:
184
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
185
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
186
+ Enabled: false
187
+
188
+ Style/LambdaCall:
189
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
190
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
191
+ Enabled: false
192
+
193
+ Style/LineEndConcatenation:
194
+ Description: >-
195
+ Use \ instead of + or << to concatenate two string literals at
196
+ line end.
197
+ Enabled: false
198
+
199
+ Metrics/MethodLength:
200
+ Description: 'Avoid methods longer than 10 lines of code.'
201
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
202
+ Enabled: false
203
+
204
+ Style/ModuleFunction:
205
+ Description: 'Checks for usage of `extend self` in modules.'
206
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
207
+ Enabled: false
208
+
209
+ Style/MultilineOperationIndentation:
210
+ Description: >-
211
+ Checks indentation of binary operations that span more than
212
+ one line.
213
+ Enabled: true
214
+ EnforcedStyle: indented
215
+
216
+ Style/MultilineBlockChain:
217
+ Description: 'Avoid multi-line chains of blocks.'
218
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
219
+ Enabled: false
220
+
221
+ Style/MultilineMethodCallIndentation:
222
+ Description: >-
223
+ Checks indentation of method calls with the dot operator
224
+ that span more than one line.
225
+ Enabled: true
226
+ EnforcedStyle: indented
227
+
228
+ Style/NegatedIf:
229
+ Description: >-
230
+ Favor unless over if for negative conditions
231
+ (or control flow or).
232
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
233
+ Enabled: false
234
+
235
+ Style/NegatedWhile:
236
+ Description: 'Favor until over while for negative conditions.'
237
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
238
+ Enabled: false
239
+
240
+ Style/Next:
241
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
242
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
243
+ Enabled: false
244
+
245
+ Style/NilComparison:
246
+ Description: 'Prefer x.nil? to x == nil.'
247
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
248
+ Enabled: false
249
+
250
+ Style/Not:
251
+ Description: 'Use ! instead of not.'
252
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
253
+ Enabled: false
254
+
255
+ Style/NumericLiterals:
256
+ Description: >-
257
+ Add underscores to large numeric literals to improve their
258
+ readability.
259
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
260
+ Enabled: false
261
+
262
+ Style/OneLineConditional:
263
+ Description: >-
264
+ Favor the ternary operator(?:) over
265
+ if/then/else/end constructs.
266
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
267
+ Enabled: false
268
+
269
+ Style/OpMethod:
270
+ Description: 'When defining binary operators, name the argument other.'
271
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
272
+ Enabled: false
273
+
274
+ Metrics/ParameterLists:
275
+ Description: 'Avoid parameter lists longer than three or four parameters.'
276
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
277
+ Enabled: false
278
+
279
+ Style/PercentLiteralDelimiters:
280
+ Description: 'Use `%`-literal delimiters consistently'
281
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
282
+ Enabled: false
283
+
284
+ Style/PerlBackrefs:
285
+ Description: 'Avoid Perl-style regex back references.'
286
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
287
+ Enabled: false
288
+
289
+ Style/PredicateName:
290
+ Description: 'Check the names of predicate methods.'
291
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
292
+ NamePrefixBlacklist:
293
+ - is_
294
+ Exclude:
295
+ - spec/**/*
296
+
297
+ Style/Proc:
298
+ Description: 'Use proc instead of Proc.new.'
299
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
300
+ Enabled: false
301
+
302
+ Style/RaiseArgs:
303
+ Description: 'Checks the arguments passed to raise/fail.'
304
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
305
+ Enabled: false
306
+
307
+ Style/RegexpLiteral:
308
+ Description: 'Use / or %r around regular expressions.'
309
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
310
+ Enabled: false
311
+
312
+ Style/SelfAssignment:
313
+ Description: >-
314
+ Checks for places where self-assignment shorthand should have
315
+ been used.
316
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
317
+ Enabled: false
318
+
319
+ Style/SingleLineBlockParams:
320
+ Description: 'Enforces the names of some block params.'
321
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
322
+ Enabled: false
323
+
324
+ Style/SingleLineMethods:
325
+ Description: 'Avoid single-line methods.'
326
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
327
+ Enabled: false
328
+
329
+ Style/SignalException:
330
+ Description: 'Checks for proper usage of fail and raise.'
331
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
332
+ Enabled: false
333
+
334
+ Style/SpecialGlobalVars:
335
+ Description: 'Avoid Perl-style global variables.'
336
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
337
+ Enabled: false
338
+
339
+ Style/TrailingCommaInArguments:
340
+ Description: 'Checks for trailing comma in argument lists.'
341
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
342
+ EnforcedStyleForMultiline: comma
343
+ SupportedStyles:
344
+ - comma
345
+ - consistent_comma
346
+ - no_comma
347
+ Enabled: true
348
+
349
+ Style/TrailingCommaInLiteral:
350
+ Description: 'Checks for trailing comma in array and hash literals.'
351
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
352
+ EnforcedStyleForMultiline: comma
353
+ SupportedStyles:
354
+ - comma
355
+ - consistent_comma
356
+ - no_comma
357
+ Enabled: true
358
+
359
+ Style/TrivialAccessors:
360
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
361
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
362
+ Enabled: false
363
+
364
+ Style/VariableInterpolation:
365
+ Description: >-
366
+ Don't interpolate global, instance and class variables
367
+ directly in strings.
368
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
369
+ Enabled: false
370
+
371
+ Style/WhenThen:
372
+ Description: 'Use when x then ... for one-line cases.'
373
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
374
+ Enabled: false
375
+
376
+ Style/WhileUntilModifier:
377
+ Description: >-
378
+ Favor modifier while/until usage when you have a
379
+ single-line body.
380
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
381
+ Enabled: false
382
+
383
+ Style/WordArray:
384
+ Description: 'Use %w or %W for arrays of words.'
385
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
386
+ Enabled: false
387
+
388
+ # Lint
389
+
390
+ Lint/AmbiguousOperator:
391
+ Description: >-
392
+ Checks for ambiguous operators in the first argument of a
393
+ method invocation without parentheses.
394
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
395
+ Enabled: false
396
+
397
+ Lint/AmbiguousRegexpLiteral:
398
+ Description: >-
399
+ Checks for ambiguous regexp literals in the first argument of
400
+ a method invocation without parenthesis.
401
+ Enabled: false
402
+
403
+ Lint/AssignmentInCondition:
404
+ Description: "Don't use assignment in conditions."
405
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
406
+ Enabled: false
407
+
408
+ Lint/CircularArgumentReference:
409
+ Description: "Don't refer to the keyword argument in the default value."
410
+ Enabled: false
411
+
412
+ Lint/ConditionPosition:
413
+ Description: >-
414
+ Checks for condition placed in a confusing position relative to
415
+ the keyword.
416
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
417
+ Enabled: false
418
+
419
+ Lint/DeprecatedClassMethods:
420
+ Description: 'Check for deprecated class method calls.'
421
+ Enabled: false
422
+
423
+ Lint/DuplicatedKey:
424
+ Description: 'Check for duplicate keys in hash literals.'
425
+ Enabled: false
426
+
427
+ Lint/EachWithObjectArgument:
428
+ Description: 'Check for immutable argument given to each_with_object.'
429
+ Enabled: false
430
+
431
+ Lint/ElseLayout:
432
+ Description: 'Check for odd code arrangement in an else block.'
433
+ Enabled: false
434
+
435
+ Lint/FormatParameterMismatch:
436
+ Description: 'The number of parameters to format/sprint must match the fields.'
437
+ Enabled: false
438
+
439
+ Lint/HandleExceptions:
440
+ Description: "Don't suppress exception."
441
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
442
+ Enabled: false
443
+
444
+ Lint/InvalidCharacterLiteral:
445
+ Description: >-
446
+ Checks for invalid character literals with a non-escaped
447
+ whitespace character.
448
+ Enabled: false
449
+
450
+ Style/InitialIndentation:
451
+ Description: >-
452
+ Checks the indentation of the first non-blank non-comment line in a file.
453
+ Enabled: false
454
+
455
+ Lint/LiteralInCondition:
456
+ Description: 'Checks of literals used in conditions.'
457
+ Enabled: false
458
+
459
+ Lint/LiteralInInterpolation:
460
+ Description: 'Checks for literals used in interpolation.'
461
+ Enabled: false
462
+
463
+ Lint/Loop:
464
+ Description: >-
465
+ Use Kernel#loop with break rather than begin/end/until or
466
+ begin/end/while for post-loop tests.
467
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
468
+ Enabled: false
469
+
470
+ Lint/NestedMethodDefinition:
471
+ Description: 'Do not use nested method definitions.'
472
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
473
+ Enabled: false
474
+
475
+ Lint/NonLocalExitFromIterator:
476
+ Description: 'Do not use return in iterator to cause non-local exit.'
477
+ Enabled: false
478
+
479
+ Lint/ParenthesesAsGroupedExpression:
480
+ Description: >-
481
+ Checks for method calls with a space before the opening
482
+ parenthesis.
483
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
484
+ Enabled: false
485
+
486
+ Lint/RequireParentheses:
487
+ Description: >-
488
+ Use parentheses in the method call to avoid confusion
489
+ about precedence.
490
+ Enabled: false
491
+
492
+ Lint/UnderscorePrefixedVariableName:
493
+ Description: 'Do not use prefix `_` for a variable that is used.'
494
+ Enabled: false
495
+
496
+ Lint/UnneededDisable:
497
+ Description: >-
498
+ Checks for rubocop:disable comments that can be removed.
499
+ Note: this cop is not disabled when disabling all cops.
500
+ It must be explicitly disabled.
501
+ Enabled: false
502
+
503
+ Lint/Void:
504
+ Description: 'Possible use of operator/literal/variable in void context.'
505
+ Enabled: false
506
+
507
+ # Performance
508
+
509
+ Performance/CaseWhenSplat:
510
+ Description: >-
511
+ Place `when` conditions that use splat at the end
512
+ of the list of `when` branches.
513
+ Enabled: false
514
+
515
+ Performance/Count:
516
+ Description: >-
517
+ Use `count` instead of `select...size`, `reject...size`,
518
+ `select...count`, `reject...count`, `select...length`,
519
+ and `reject...length`.
520
+ Enabled: false
521
+
522
+ Performance/Detect:
523
+ Description: >-
524
+ Use `detect` instead of `select.first`, `find_all.first`,
525
+ `select.last`, and `find_all.last`.
526
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
527
+ Enabled: false
528
+
529
+ Performance/FlatMap:
530
+ Description: >-
531
+ Use `Enumerable#flat_map`
532
+ instead of `Enumerable#map...Array#flatten(1)`
533
+ or `Enumberable#collect..Array#flatten(1)`
534
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
535
+ Enabled: false
536
+
537
+ Performance/ReverseEach:
538
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
539
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
540
+ Enabled: false
541
+
542
+ Performance/Sample:
543
+ Description: >-
544
+ Use `sample` instead of `shuffle.first`,
545
+ `shuffle.last`, and `shuffle[Fixnum]`.
546
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
547
+ Enabled: false
548
+
549
+ Performance/Size:
550
+ Description: >-
551
+ Use `size` instead of `count` for counting
552
+ the number of elements in `Array` and `Hash`.
553
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
554
+ Enabled: false
555
+
556
+ Performance/StringReplacement:
557
+ Description: >-
558
+ Use `tr` instead of `gsub` when you are replacing the same
559
+ number of characters. Use `delete` instead of `gsub` when
560
+ you are deleting characters.
561
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
562
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at tommy.schaefer@teecom.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-azure-adv2.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 TEECOM
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,40 @@
1
+ # Omniauth::Azure::Adv2
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/omniauth/azure/adv2`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'omniauth-azure-adv2'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install omniauth-azure-adv2
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-azure-adv2. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ 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,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'omniauth/azure/adv2'
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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module AzureADV2
3
+ VERSION = '0.0.5'.freeze
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'jwt'
2
+ require 'omniauth'
3
+
4
+ require 'omniauth/azure_adv2/version'
5
+ require 'omniauth/azure_adv2/id_token_decoder'
6
+ require 'omniauth/azure_adv2/key_set'
7
+ require 'omniauth/azure_adv2/openid_config'
8
+
9
+ require 'omniauth/strategies/azure_adv2'
@@ -0,0 +1,144 @@
1
+ require 'jwt'
2
+ require 'omniauth'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class AzureADV2
7
+ include OmniAuth::Strategy
8
+ include Omniauth::AzureADV2
9
+
10
+ class OAuthError < StandardError; end
11
+
12
+ DEFAULT_RESPONSE_TYPE = 'code id_token'
13
+ DEFAULT_RESPONSE_MODE = 'form_post'
14
+
15
+ option :name, :azure_adv2
16
+
17
+ args [:client_id, :client_secret]
18
+
19
+ option :client_id, nil
20
+ option :client_secret, nil
21
+
22
+ uid { @claims['sub'] }
23
+
24
+ info do
25
+ {
26
+ name: @claims['name'],
27
+ email: @claims['email'].present? ? @claims['email'] : fetch_email,
28
+ }
29
+ end
30
+
31
+ credentials { { token: @access_token } }
32
+
33
+ extra do
34
+ {
35
+ session_state: @session_state,
36
+ raw_info: {
37
+ id_token: @id_token,
38
+ id_token_claims: @claims,
39
+ id_token_header: @header
40
+ }
41
+ }
42
+ end
43
+
44
+ def request_phase
45
+ uri = URI(openid_config.authorization_endpoint)
46
+ uri.query = URI.encode_www_form(client_id: client_id,
47
+ redirect_uri: callback_url,
48
+ response_mode: response_mode,
49
+ response_type: response_type,
50
+ scope: 'openid profile email https://graph.microsoft.com/user.read',
51
+ nonce: new_nonce)
52
+
53
+ redirect uri.to_s
54
+ end
55
+
56
+ def callback_phase
57
+ error = request.params['error_reason'] || request.params['error']
58
+ fail(OAuthError, error) if error
59
+
60
+ @session_state = request.params['session_state']
61
+ @code = request.params['code']
62
+
63
+ @access_token, @id_token = exchange_code_for_creds(@code)
64
+ @claims, @header = validate_and_parse_id_token(@id_token)
65
+
66
+ super
67
+ end
68
+
69
+ private
70
+
71
+ def exchange_code_for_creds(code)
72
+ uri = URI('https://login.microsoftonline.com/common/oauth2/v2.0/token')
73
+ res = Net::HTTP.post_form(
74
+ uri,
75
+ 'code': code,
76
+ 'grant_type': 'authorization_code',
77
+ 'scope': 'https://graph.microsoft.com/user.read',
78
+ 'redirect_uri': callback_url,
79
+ 'client_id': client_id,
80
+ 'client_secret': client_secret,
81
+ )
82
+
83
+ parsed = JSON.parse(res.body)
84
+
85
+ [parsed['access_token'], parsed['id_token']]
86
+ end
87
+
88
+ def fetch_email
89
+ uri = URI('https://graph.microsoft.com/beta/me')
90
+ req = Net::HTTP::Get.new(uri.path)
91
+ req.add_field('Authorization', "Bearer #{@access_token}")
92
+
93
+ res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
94
+ http.request(req)
95
+ end
96
+
97
+ parsed = JSON.parse(res.body)
98
+
99
+ parsed['mail'].present? ? parsed['mail'] : parsed['userPrincipalName']
100
+ end
101
+
102
+ def new_nonce
103
+ session['omniauth-azure-activedirectory.nonce'] = SecureRandom.uuid
104
+ end
105
+
106
+ def openid_config
107
+ OpenIDConfig.fetch(tid: 'common')
108
+ end
109
+
110
+ def response_type
111
+ options[:response_type] || DEFAULT_RESPONSE_TYPE
112
+ end
113
+
114
+ def response_mode
115
+ options[:response_mode] || DEFAULT_RESPONSE_MODE
116
+ end
117
+
118
+ def validate_and_parse_id_token(id_token)
119
+ IDTokenDecoder.new(
120
+ id_token: id_token,
121
+ client_id: client_id,
122
+ nonce: read_nonce,
123
+ keyset: openid_config.keys,
124
+ ).run
125
+ end
126
+
127
+ def client_id
128
+ return options.client_id if options.client_id
129
+ fail StandardError, 'No client_id specified in AzureAD configuration.'
130
+ end
131
+
132
+ def client_secret
133
+ return options.client_secret if options.client_secret
134
+ fail StandardError, 'No client_secret specified in AzureAD configuration.'
135
+ end
136
+
137
+ def read_nonce
138
+ session.delete('omniauth-azure-activedirectory.nonce')
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ OmniAuth.config.add_camelization 'azure_adv2', 'AzureADV2'
@@ -0,0 +1 @@
1
+ require 'omniauth/azure_adv2'
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/azure_adv2/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'omniauth-azure-adv2'
8
+ spec.version = Omniauth::AzureADV2::VERSION
9
+ spec.authors = ['Tom Schaefer', 'TEECOM']
10
+ spec.email = ['tommy.schaefer@teecom.com']
11
+
12
+ spec.summary = 'Azure Active Directory V2 strategy for OmniAuth'
13
+ spec.description = 'Allows developers to authenticate with Azure AD V2'
14
+ spec.homepage = 'https://github.com/TEECOM/omniauth-azure-adv2'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").
18
+ reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_runtime_dependency 'jwt', '~> 1.5'
22
+ spec.add_runtime_dependency 'omniauth', '~> 1.1'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.12'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.0'
27
+ spec.add_development_dependency 'rubocop', '~> 0.42'
28
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-azure-adv2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ platform: ruby
6
+ authors:
7
+ - Tom Schaefer
8
+ - TEECOM
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-09-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jwt
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.5'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.5'
28
+ - !ruby/object:Gem::Dependency
29
+ name: omniauth
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.1'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.1'
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.12'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.12'
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: '3.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubocop
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.42'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.42'
98
+ description: Allows developers to authenticate with Azure AD V2
99
+ email:
100
+ - tommy.schaefer@teecom.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".rubocop.yml"
108
+ - ".travis.yml"
109
+ - CODE_OF_CONDUCT.md
110
+ - Gemfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - lib/omniauth-azure-adv2.rb
117
+ - lib/omniauth/azure_adv2.rb
118
+ - lib/omniauth/azure_adv2/version.rb
119
+ - lib/omniauth/strategies/azure_adv2.rb
120
+ - omniauth-azure-adv2.gemspec
121
+ homepage: https://github.com/TEECOM/omniauth-azure-adv2
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.5.1
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Azure Active Directory V2 strategy for OmniAuth
145
+ test_files: []