omniauth-osso 0.1.2 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.buildkite/hooks/environment +9 -0
- data/.buildkite/hooks/pre-command +7 -0
- data/.buildkite/pipeline.yml +17 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/automerge.yml +19 -0
- data/.rubocop.yml +3 -0
- data/CODE_OF_CONDUCT.md +130 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +40 -37
- data/LICENSE +109 -0
- data/bin/publish +18 -0
- data/lib/omniauth-osso/version.rb +1 -1
- data/lib/omniauth/strategies/osso.rb +47 -28
- data/omniauth-osso.gemspec +3 -2
- data/spec/omniauth/strategies/osso_spec.rb +70 -8
- data/spec/spec_helper.rb +0 -3
- metadata +26 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b09981769f4343227de216a0180af65e37801f2a2f26426525ddef929be8117a
|
4
|
+
data.tar.gz: f54ee7e9a7a03977c131b783c6e72d06f8842e314da0eb6ef0f4047ff31f64e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cc4dd0a8b35fe79b3f8c90305d7a48f2a8173589a6c35f0635f3408ff6b58b04478de29f1fa22dd78feab0df4c1246eca86541833f8d53350d0c3b7d06ba7f7
|
7
|
+
data.tar.gz: 57913a87111112e55783dd6989d7e1e987e017296e67ab9215d5cb5bf22ffd5be019031f7b536e5ef64f4118ba33927e44e8b4036d8132fc5327d98fa8da945f
|
@@ -0,0 +1,17 @@
|
|
1
|
+
steps:
|
2
|
+
- name: ":rspec:"
|
3
|
+
commands:
|
4
|
+
- bundle install
|
5
|
+
- bundle exec rspec
|
6
|
+
|
7
|
+
- name: "rubocop :male-police-officer:"
|
8
|
+
commands:
|
9
|
+
- bundle install
|
10
|
+
- bundle exec rubocop
|
11
|
+
|
12
|
+
- block: ":rubygems: Publish :red_button:"
|
13
|
+
if: build.tag != null
|
14
|
+
|
15
|
+
- name: "Push :rubygems:"
|
16
|
+
commands: "./bin/publish"
|
17
|
+
if: build.tag != null
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: auto-merge
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
auto-approve:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- uses: ahmadnassri/action-dependabot-auto-merge@v2
|
12
|
+
with:
|
13
|
+
target: minor
|
14
|
+
github-token: ${{ secrets.TOKEN }}
|
15
|
+
- uses: hmarr/auto-approve-action@v2.0.0
|
16
|
+
if: github.actor == 'dependabot[bot]'
|
17
|
+
with:
|
18
|
+
github-token: "${{ secrets.TOKEN }}"
|
19
|
+
|
data/.rubocop.yml
CHANGED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
|
2
|
+
# Contributor Covenant Code of Conduct
|
3
|
+
|
4
|
+
## Our Pledge
|
5
|
+
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our
|
7
|
+
community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
9
|
+
identity and expression, level of experience, education, socio-economic status,
|
10
|
+
nationality, personal appearance, race, religion, or sexual identity
|
11
|
+
and orientation.
|
12
|
+
|
13
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
14
|
+
diverse, inclusive, and healthy community.
|
15
|
+
|
16
|
+
## Our Standards
|
17
|
+
|
18
|
+
Examples of behavior that contributes to a positive environment for our
|
19
|
+
community include:
|
20
|
+
|
21
|
+
* Demonstrating empathy and kindness toward other people
|
22
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
23
|
+
* Giving and gracefully accepting constructive feedback
|
24
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
25
|
+
and learning from the experience
|
26
|
+
* Focusing on what is best not just for us as individuals, but for the
|
27
|
+
overall community
|
28
|
+
|
29
|
+
Examples of unacceptable behavior include:
|
30
|
+
|
31
|
+
* The use of sexualized language or imagery, and sexual attention or
|
32
|
+
advances of any kind
|
33
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
34
|
+
* Public or private harassment
|
35
|
+
* Publishing others' private information, such as a physical or email
|
36
|
+
address, without their explicit permission
|
37
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
38
|
+
professional setting
|
39
|
+
|
40
|
+
## Enforcement Responsibilities
|
41
|
+
|
42
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
43
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
44
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
45
|
+
or harmful.
|
46
|
+
|
47
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
48
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
49
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
50
|
+
decisions when appropriate.
|
51
|
+
|
52
|
+
## Scope
|
53
|
+
|
54
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
55
|
+
an individual is officially representing the community in public spaces.
|
56
|
+
Examples of representing our community include using an official e-mail address,
|
57
|
+
posting via an official social media account, or acting as an appointed
|
58
|
+
representative at an online or offline event.
|
59
|
+
|
60
|
+
## Enforcement
|
61
|
+
|
62
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
63
|
+
reported to the community leaders responsible for enforcement at
|
64
|
+
sbauch@gmail.com.
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
66
|
+
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
68
|
+
reporter of any incident.
|
69
|
+
|
70
|
+
## Enforcement Guidelines
|
71
|
+
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
74
|
+
|
75
|
+
### 1. Correction
|
76
|
+
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
78
|
+
unprofessional or unwelcome in the community.
|
79
|
+
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
83
|
+
|
84
|
+
### 2. Warning
|
85
|
+
|
86
|
+
**Community Impact**: A violation through a single incident or series
|
87
|
+
of actions.
|
88
|
+
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
93
|
+
like social media. Violating these terms may lead to a temporary or
|
94
|
+
permanent ban.
|
95
|
+
|
96
|
+
### 3. Temporary Ban
|
97
|
+
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
99
|
+
sustained inappropriate behavior.
|
100
|
+
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
102
|
+
communication with the community for a specified period of time. No public or
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
105
|
+
Violating these terms may lead to a permanent ban.
|
106
|
+
|
107
|
+
### 4. Permanent Ban
|
108
|
+
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
112
|
+
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
114
|
+
the community.
|
115
|
+
|
116
|
+
## Attribution
|
117
|
+
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
119
|
+
version 2.0, available at
|
120
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
121
|
+
|
122
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
123
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
124
|
+
|
125
|
+
[homepage]: https://www.contributor-covenant.org
|
126
|
+
|
127
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
128
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
129
|
+
https://www.contributor-covenant.org/translations.
|
130
|
+
|
data/Gemfile
CHANGED
@@ -7,9 +7,9 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
7
7
|
group :test do
|
8
8
|
gem 'pry'
|
9
9
|
gem 'rack-test'
|
10
|
-
gem 'rspec', '~> 3.
|
10
|
+
gem 'rspec', '~> 3.10'
|
11
11
|
gem 'rubocop'
|
12
|
-
gem 'webmock', '~> 3.
|
12
|
+
gem 'webmock', '~> 3.10'
|
13
13
|
end
|
14
14
|
|
15
15
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-osso (0.1.
|
5
|
-
omniauth-oauth2 (
|
4
|
+
omniauth-osso (0.1.6)
|
5
|
+
omniauth-oauth2 (>= 1.6, < 1.8)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
addressable (2.7.0)
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
12
|
-
ast (2.4.
|
13
|
-
coderay (1.1.
|
14
|
-
crack (0.4.
|
15
|
-
|
16
|
-
|
17
|
-
faraday (1.0.1)
|
12
|
+
ast (2.4.1)
|
13
|
+
coderay (1.1.3)
|
14
|
+
crack (0.4.4)
|
15
|
+
diff-lcs (1.4.4)
|
16
|
+
faraday (1.1.0)
|
18
17
|
multipart-post (>= 1.2, < 3)
|
18
|
+
ruby2_keywords
|
19
19
|
hashdiff (1.0.1)
|
20
20
|
hashie (4.1.0)
|
21
|
-
|
22
|
-
jwt (2.2.1)
|
21
|
+
jwt (2.2.2)
|
23
22
|
method_source (1.0.0)
|
24
|
-
multi_json (1.
|
23
|
+
multi_json (1.15.0)
|
25
24
|
multi_xml (0.6.0)
|
26
25
|
multipart-post (2.1.1)
|
27
26
|
oauth2 (1.4.4)
|
@@ -33,46 +32,50 @@ GEM
|
|
33
32
|
omniauth (1.9.1)
|
34
33
|
hashie (>= 3.4.6)
|
35
34
|
rack (>= 1.6.2, < 3)
|
36
|
-
omniauth-oauth2 (1.
|
37
|
-
oauth2 (~> 1.
|
35
|
+
omniauth-oauth2 (1.7.0)
|
36
|
+
oauth2 (~> 1.4)
|
38
37
|
omniauth (~> 1.9)
|
39
|
-
parallel (1.
|
40
|
-
parser (2.7.
|
41
|
-
ast (~> 2.4.
|
42
|
-
pry (0.13.
|
38
|
+
parallel (1.20.1)
|
39
|
+
parser (2.7.2.0)
|
40
|
+
ast (~> 2.4.1)
|
41
|
+
pry (0.13.1)
|
43
42
|
coderay (~> 1.1)
|
44
43
|
method_source (~> 1.0)
|
45
|
-
public_suffix (4.0.
|
46
|
-
rack (2.2.
|
44
|
+
public_suffix (4.0.6)
|
45
|
+
rack (2.2.3)
|
47
46
|
rack-test (1.1.0)
|
48
47
|
rack (>= 1.0, < 3)
|
49
48
|
rainbow (3.0.0)
|
49
|
+
regexp_parser (2.0.0)
|
50
50
|
rexml (3.2.4)
|
51
|
-
rspec (3.
|
52
|
-
rspec-core (~> 3.
|
53
|
-
rspec-expectations (~> 3.
|
54
|
-
rspec-mocks (~> 3.
|
55
|
-
rspec-core (3.
|
56
|
-
rspec-support (~> 3.
|
57
|
-
rspec-expectations (3.
|
51
|
+
rspec (3.10.0)
|
52
|
+
rspec-core (~> 3.10.0)
|
53
|
+
rspec-expectations (~> 3.10.0)
|
54
|
+
rspec-mocks (~> 3.10.0)
|
55
|
+
rspec-core (3.10.0)
|
56
|
+
rspec-support (~> 3.10.0)
|
57
|
+
rspec-expectations (3.10.0)
|
58
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.
|
60
|
-
rspec-mocks (3.
|
59
|
+
rspec-support (~> 3.10.0)
|
60
|
+
rspec-mocks (3.10.0)
|
61
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-support (3.
|
64
|
-
rubocop (
|
65
|
-
jaro_winkler (~> 1.5.1)
|
62
|
+
rspec-support (~> 3.10.0)
|
63
|
+
rspec-support (3.10.0)
|
64
|
+
rubocop (1.6.1)
|
66
65
|
parallel (~> 1.10)
|
67
|
-
parser (>= 2.7.
|
66
|
+
parser (>= 2.7.1.5)
|
68
67
|
rainbow (>= 2.2.2, < 4.0)
|
68
|
+
regexp_parser (>= 1.8, < 3.0)
|
69
69
|
rexml
|
70
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
70
71
|
ruby-progressbar (~> 1.7)
|
71
72
|
unicode-display_width (>= 1.4.0, < 2.0)
|
73
|
+
rubocop-ast (1.3.0)
|
74
|
+
parser (>= 2.7.1.5)
|
72
75
|
ruby-progressbar (1.10.1)
|
73
|
-
|
76
|
+
ruby2_keywords (0.0.2)
|
74
77
|
unicode-display_width (1.7.0)
|
75
|
-
webmock (3.
|
78
|
+
webmock (3.10.0)
|
76
79
|
addressable (>= 2.3.6)
|
77
80
|
crack (>= 0.3.2)
|
78
81
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -85,9 +88,9 @@ DEPENDENCIES
|
|
85
88
|
omniauth-osso!
|
86
89
|
pry
|
87
90
|
rack-test
|
88
|
-
rspec (~> 3.
|
91
|
+
rspec (~> 3.10)
|
89
92
|
rubocop
|
90
|
-
webmock (~> 3.
|
93
|
+
webmock (~> 3.10)
|
91
94
|
|
92
95
|
BUNDLED WITH
|
93
96
|
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
Business Source License 1.1
|
2
|
+
|
3
|
+
Parameters
|
4
|
+
|
5
|
+
Licensor: EnterpriseOSS, Inc.
|
6
|
+
Licensed Work: omniauth-osso
|
7
|
+
The Licensed Work is (c) 2020 EnterpriseOSS, Inc.
|
8
|
+
|
9
|
+
Additional Use Grant: You and your Authorized Users may make use of the
|
10
|
+
Licensed Work for your internal business purposes,
|
11
|
+
provided that you do not (i) rent, lease, copy, transfer,
|
12
|
+
resell, sublicense, lease, time-share, or otherwise provide
|
13
|
+
access to the Licensed Work to a third party (except
|
14
|
+
Authorized Users) or (ii) incorporate the Licensed Work
|
15
|
+
(or any portion of such) with, or use it with or to provide,
|
16
|
+
any site, product, or service, other than on sites/applications
|
17
|
+
owned and operated by you.
|
18
|
+
|
19
|
+
An “Authorized User” is defined as an individual person
|
20
|
+
(e.g. your employee, contractor, agent) who is registered and
|
21
|
+
permitted by you to use the Licensed Work subject to these
|
22
|
+
restrictions.
|
23
|
+
|
24
|
+
Change Date: 2025-10-01
|
25
|
+
|
26
|
+
Change License: Apache License, Version 2.0
|
27
|
+
|
28
|
+
For information about alternative licensing arrangements for the Software,
|
29
|
+
contact: hello@enterpriseoss.dev
|
30
|
+
|
31
|
+
Notice
|
32
|
+
|
33
|
+
The Business Source License (this document, or the "License") is not an Open
|
34
|
+
Source license. However, the Licensed Work will eventually be made available
|
35
|
+
under an Open Source License, as stated in this License.
|
36
|
+
|
37
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
38
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
39
|
+
|
40
|
+
-----------------------------------------------------------------------------
|
41
|
+
|
42
|
+
Business Source License 1.1
|
43
|
+
|
44
|
+
Terms
|
45
|
+
|
46
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
47
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
48
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
49
|
+
production use.
|
50
|
+
|
51
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
52
|
+
available distribution of a specific version of the Licensed Work under this
|
53
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
54
|
+
the terms of the Change License, and the rights granted in the paragraph
|
55
|
+
above terminate.
|
56
|
+
|
57
|
+
If your use of the Licensed Work does not comply with the requirements
|
58
|
+
currently in effect as described in this License, you must purchase a
|
59
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
60
|
+
resellers, or you must refrain from using the Licensed Work.
|
61
|
+
|
62
|
+
All copies of the original and modified Licensed Work, and derivative works
|
63
|
+
of the Licensed Work, are subject to this License. This License applies
|
64
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
65
|
+
for each version of the Licensed Work released by Licensor.
|
66
|
+
|
67
|
+
You must conspicuously display this License on each original or modified copy
|
68
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
69
|
+
modified form from a third party, the terms and conditions set forth in this
|
70
|
+
License apply to your use of that work.
|
71
|
+
|
72
|
+
Any use of the Licensed Work in violation of this License will automatically
|
73
|
+
terminate your rights under this License for the current and all other
|
74
|
+
versions of the Licensed Work.
|
75
|
+
|
76
|
+
This License does not grant you any right in any trademark or logo of
|
77
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
78
|
+
Licensor as expressly required by this License).
|
79
|
+
|
80
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
81
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
82
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
83
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
84
|
+
TITLE.
|
85
|
+
|
86
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
87
|
+
your works, and to refer to it using the trademark "Business Source License",
|
88
|
+
as long as you comply with the Covenants of Licensor below.
|
89
|
+
|
90
|
+
Covenants of Licensor
|
91
|
+
|
92
|
+
In consideration of the right to use this License’s text and the "Business
|
93
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
94
|
+
other recipients of the licensed work to be provided by Licensor:
|
95
|
+
|
96
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
97
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
98
|
+
where "compatible" means that software provided under the Change License can
|
99
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
100
|
+
later version. Licensor may specify additional Change Licenses without
|
101
|
+
limitation.
|
102
|
+
|
103
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
104
|
+
impose any additional restriction on the right granted in this License, as
|
105
|
+
the Additional Use Grant; or (b) insert the text "None".
|
106
|
+
|
107
|
+
3. To specify a Change Date.
|
108
|
+
|
109
|
+
4. Not to modify this License in any other way.
|
data/bin/publish
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# Scriptacular - gemify.sh
|
3
|
+
# Create a Ruby gem and push it to rubygems.org
|
4
|
+
# Copyright 2013 Christopher Simpkins
|
5
|
+
# MIT License
|
6
|
+
|
7
|
+
GEM_NAME="omniauth-osso"
|
8
|
+
GEMSPEC_SUFFIX=".gemspec"
|
9
|
+
|
10
|
+
# run the gem build and parse for the gem release filename
|
11
|
+
GEM_BUILD_NAME=$(gem build "$GEM_NAME$GEMSPEC_SUFFIX" | awk '/File/ {print $2}' -)
|
12
|
+
|
13
|
+
if [ -z "$GEM_BUILD_NAME" ]; then
|
14
|
+
echo "The gem build failed." >&2
|
15
|
+
exit 1
|
16
|
+
fi
|
17
|
+
|
18
|
+
gem push $GEM_BUILD_NAME
|
@@ -6,17 +6,12 @@ module OmniAuth
|
|
6
6
|
module Strategies
|
7
7
|
# The main source for the Osso Omniauth Strategy
|
8
8
|
class Osso < OmniAuth::Strategies::OAuth2
|
9
|
-
|
9
|
+
attr_accessor :env
|
10
10
|
|
11
11
|
option :name, 'osso'
|
12
12
|
option :client_id, nil
|
13
13
|
option :client_secret, nil
|
14
|
-
option :client_options, { site: ENV['OSSO_BASE_URL'] }
|
15
|
-
option :authorize_params, { state: SecureRandom.hex(24) }
|
16
14
|
option :authorize_options, %i[state]
|
17
|
-
option :token_params, {}
|
18
|
-
option :token_options, []
|
19
|
-
option :auth_token_params, {}
|
20
15
|
option :provider_ignores_state, false
|
21
16
|
|
22
17
|
def request_phase
|
@@ -24,25 +19,16 @@ module OmniAuth
|
|
24
19
|
client
|
25
20
|
.auth_code
|
26
21
|
.authorize_url(
|
27
|
-
|
28
|
-
|
29
|
-
domain: request_domain
|
30
|
-
}.merge(authorize_params)
|
22
|
+
request_params
|
23
|
+
.merge(authorize_params)
|
31
24
|
)
|
32
25
|
)
|
33
26
|
end
|
34
27
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
@env ||= {}
|
40
|
-
@env['rack.session'] ||= {}
|
41
|
-
end
|
42
|
-
|
43
|
-
session['omniauth.state'] = params[:state]
|
44
|
-
|
45
|
-
params
|
28
|
+
def request_params
|
29
|
+
{
|
30
|
+
redirect_uri: callback_url
|
31
|
+
}.merge(user_param)
|
46
32
|
end
|
47
33
|
|
48
34
|
uid { raw_info['id'] }
|
@@ -55,7 +41,8 @@ module OmniAuth
|
|
55
41
|
|
56
42
|
extra do
|
57
43
|
{
|
58
|
-
idp: raw_info['idp']
|
44
|
+
idp: raw_info['idp'],
|
45
|
+
requested: raw_info['requested']
|
59
46
|
}
|
60
47
|
end
|
61
48
|
|
@@ -63,16 +50,48 @@ module OmniAuth
|
|
63
50
|
@raw_info ||= access_token.get("/oauth/me?access_token=#{access_token.token}").parsed
|
64
51
|
end
|
65
52
|
|
66
|
-
|
53
|
+
def callback_phase # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
54
|
+
error = request.params['error_reason'] || request.params['error']
|
67
55
|
|
68
|
-
|
69
|
-
|
56
|
+
if error
|
57
|
+
fail!(
|
58
|
+
error,
|
59
|
+
CallbackError.new(
|
60
|
+
request.params['error'], request.params['error_description'] ||
|
61
|
+
request.params['error_reason'], request.params['error_uri']
|
62
|
+
)
|
63
|
+
)
|
64
|
+
elsif request.params['state'] != 'IDP_INITIATED' &&
|
65
|
+
request.params['state'] != session.delete('omniauth.state')
|
66
|
+
|
67
|
+
fail!(:csrf_detected, CallbackError.new(:csrf_detected, 'CSRF detected'))
|
68
|
+
else
|
69
|
+
self.access_token = build_access_token
|
70
|
+
self.access_token = access_token.refresh! if access_token.expired?
|
71
|
+
env['omniauth.auth'] = auth_hash
|
72
|
+
call_app!
|
73
|
+
end
|
74
|
+
rescue ::OAuth2::Error, CallbackError => e
|
75
|
+
fail!(:invalid_credentials, e)
|
76
|
+
rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
|
77
|
+
fail!(:timeout, e)
|
78
|
+
rescue ::SocketError => e
|
79
|
+
fail!(:failed_to_connect, e)
|
80
|
+
end
|
70
81
|
|
71
|
-
|
82
|
+
protected
|
83
|
+
|
84
|
+
def callback_url
|
85
|
+
ENV['OSSO_REDIRECT_URI'] || super
|
86
|
+
end
|
72
87
|
|
73
|
-
|
88
|
+
def user_param
|
89
|
+
return @user_param if defined?(@user_param)
|
74
90
|
|
75
|
-
@
|
91
|
+
@user_param = {
|
92
|
+
domain: request.params['domain'],
|
93
|
+
email: request.params['email']
|
94
|
+
}.compact
|
76
95
|
end
|
77
96
|
end
|
78
97
|
end
|
data/omniauth-osso.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.description = 'An OAuth 2.0 OmniAuth provider for Osso SSO.'
|
9
9
|
gem.summary = gem.description
|
10
10
|
gem.homepage = 'https://github.com/enterprise-oss/omniauth-osso'
|
11
|
-
gem.license = '
|
11
|
+
gem.license = 'BSL'
|
12
12
|
|
13
|
-
gem.add_dependency 'omniauth-oauth2', '
|
13
|
+
gem.add_dependency 'omniauth-oauth2', '>= 1.6', '< 1.8'
|
14
14
|
gem.add_development_dependency 'bundler', '~> 2.1'
|
15
15
|
|
16
16
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.name = 'omniauth-osso'
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
gem.version = OmniAuth::Osso::VERSION
|
22
|
+
gem.required_ruby_version = '~> 2.4'
|
22
23
|
end
|
@@ -46,28 +46,90 @@ describe OmniAuth::Strategies::Osso do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'includes custom state in the authorize params' do
|
49
|
-
instance = subject.new('abc', 'def',
|
49
|
+
instance = subject.new('abc', 'def', state: 'qux')
|
50
50
|
expect(instance.authorize_params.keys).to include('state')
|
51
51
|
expect(instance.session['omniauth.state']).to eq('qux')
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe '#
|
55
|
+
describe '#request_params' do
|
56
|
+
let(:url) { 'https://example.com/auth/osso' }
|
56
57
|
subject { fresh_strategy }
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
before do
|
60
|
+
ENV['OSSO_REDIRECT_URI'] = url
|
61
|
+
ENV['OSSO_BASE_URL'] = 'https://osso-base.com'
|
61
62
|
end
|
62
63
|
|
63
|
-
it 'includes
|
64
|
-
instance = subject.new('abc', 'def'
|
65
|
-
|
64
|
+
it 'includes domain passed as a request param' do
|
65
|
+
instance = subject.new('abc', 'def')
|
66
|
+
allow(instance).to receive(:request) do
|
67
|
+
double('Request', params: { 'domain' => 'example.com' }, scheme: 'https', url: url)
|
68
|
+
end
|
69
|
+
|
70
|
+
expect(instance.request_params[:domain]).to eq('example.com')
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'includes email when an email address is passed as an authorize option' do
|
74
|
+
instance = subject.new('abc', 'def')
|
75
|
+
|
76
|
+
allow(instance).to receive(:request) do
|
77
|
+
double('Request', params: { 'email' => 'user@example.com' }, scheme: 'https', url: url)
|
78
|
+
end
|
79
|
+
|
80
|
+
expect(instance.request_params[:email]).to eq('user@example.com')
|
66
81
|
end
|
67
82
|
end
|
68
83
|
|
84
|
+
# We need to get a little hacky with testing the callback phase
|
85
|
+
# in order to cover IDP initiated flows. When a user opens
|
86
|
+
# an SP app by clicking a tile on their IDP, then the OAuth flow
|
87
|
+
# skips the first leg, and we have to ignore CSRF protection.
|
88
|
+
# Osso will send `state=IDP_INITIATED_FLOW` when this is the case,
|
89
|
+
# and here we ensure that our strategy completes the callback phase
|
90
|
+
# with this state param.
|
91
|
+
|
69
92
|
describe '#callback_phase' do
|
70
93
|
subject { fresh_strategy }
|
94
|
+
let(:url) { 'https://example.com/auth/osso/callback' }
|
95
|
+
let(:instance) { subject.new(app, 'abc', 'def') }
|
96
|
+
|
97
|
+
before do
|
98
|
+
OmniAuth.config.test_mode = true
|
99
|
+
ENV['OSSO_REDIRECT_URI'] = url
|
100
|
+
ENV['OSSO_BASE_URL'] = 'https://osso-base.com'
|
101
|
+
allow(instance).to receive(:auth_hash) { auth_hash }
|
102
|
+
instance.env = {}
|
103
|
+
end
|
104
|
+
|
105
|
+
let :auth_hash do
|
106
|
+
{
|
107
|
+
provider: 'osso',
|
108
|
+
uid: 'uuid',
|
109
|
+
info: {
|
110
|
+
email: 'user@enterprise.com',
|
111
|
+
name: 'user@enterprise.com'
|
112
|
+
},
|
113
|
+
credentials: {
|
114
|
+
},
|
115
|
+
extra: {
|
116
|
+
}
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'allows callbacks with IDP_INITIATED state param' do
|
121
|
+
allow(instance).to receive(:request) do
|
122
|
+
double('Request', params: { 'state' => 'IDP_INITIATED' }, scheme: 'https', url: url)
|
123
|
+
end
|
124
|
+
|
125
|
+
allow(instance).to receive(:build_access_token) do
|
126
|
+
double('AccessToken', expired?: false, token: 'token')
|
127
|
+
end
|
128
|
+
|
129
|
+
expect(instance).to_not receive(:fail!)
|
130
|
+
instance.callback_phase
|
131
|
+
end
|
132
|
+
|
71
133
|
it 'calls fail with the client error received' do
|
72
134
|
instance = subject.new('abc', 'def')
|
73
135
|
allow(instance).to receive(:request) do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-osso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Bauch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
22
|
+
version: '1.8'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.6'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
32
|
+
version: '1.8'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,18 +49,27 @@ email:
|
|
43
49
|
- sbauch@gmail.com
|
44
50
|
executables:
|
45
51
|
- console
|
52
|
+
- publish
|
46
53
|
- setup
|
47
54
|
extensions: []
|
48
55
|
extra_rdoc_files: []
|
49
56
|
files:
|
57
|
+
- ".buildkite/hooks/environment"
|
58
|
+
- ".buildkite/hooks/pre-command"
|
59
|
+
- ".buildkite/pipeline.yml"
|
60
|
+
- ".github/dependabot.yml"
|
61
|
+
- ".github/workflows/automerge.yml"
|
50
62
|
- ".gitignore"
|
51
63
|
- ".rspec"
|
52
64
|
- ".rubocop.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
53
66
|
- Gemfile
|
54
67
|
- Gemfile.lock
|
68
|
+
- LICENSE
|
55
69
|
- README.md
|
56
70
|
- Rakefile
|
57
71
|
- bin/console
|
72
|
+
- bin/publish
|
58
73
|
- bin/setup
|
59
74
|
- lib/omniauth-osso.rb
|
60
75
|
- lib/omniauth-osso/version.rb
|
@@ -64,7 +79,7 @@ files:
|
|
64
79
|
- spec/spec_helper.rb
|
65
80
|
homepage: https://github.com/enterprise-oss/omniauth-osso
|
66
81
|
licenses:
|
67
|
-
-
|
82
|
+
- BSL
|
68
83
|
metadata: {}
|
69
84
|
post_install_message:
|
70
85
|
rdoc_options: []
|
@@ -72,20 +87,17 @@ require_paths:
|
|
72
87
|
- lib
|
73
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
89
|
requirements:
|
75
|
-
- - "
|
90
|
+
- - "~>"
|
76
91
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
92
|
+
version: '2.4'
|
78
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
94
|
requirements:
|
80
95
|
- - ">="
|
81
96
|
- !ruby/object:Gem::Version
|
82
97
|
version: '0'
|
83
98
|
requirements: []
|
84
|
-
|
85
|
-
rubygems_version: 2.7.6.2
|
99
|
+
rubygems_version: 3.0.3
|
86
100
|
signing_key:
|
87
101
|
specification_version: 4
|
88
102
|
summary: An OAuth 2.0 OmniAuth provider for Osso SSO.
|
89
|
-
test_files:
|
90
|
-
- spec/omniauth/strategies/osso_spec.rb
|
91
|
-
- spec/spec_helper.rb
|
103
|
+
test_files: []
|