omniauth-fera 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/checks.yml +29 -0
- data/.gitignore +8 -0
- data/.idea/.gitignore +8 -0
- data/.idea/modules.xml +8 -0
- data/.idea/omniauth-fera.iml +50 -0
- data/.idea/vcs.xml +6 -0
- data/.rubocop.yml +56 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +85 -0
- data/LICENSE.txt +21 -0
- data/README.md +84 -0
- data/Rakefile +1 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/omniauth/fera/version.rb +7 -0
- data/lib/omniauth/fera.rb +2 -0
- data/lib/omniauth/strategies/fera.rb +24 -0
- data/lib/omniauth-fera.rb +1 -0
- data/omniauth-fera.gemspec +30 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dde0fdb0f28561d3a6831381dede5d9da872bca58fc430870bf544b39f1854f9
|
4
|
+
data.tar.gz: 510ab15dc521432761b8c9d670a864dd29f274ce258cd37fd389322e15d8fc01
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3ba205ac4c6bd448ebfeade3733afedba7429b55e03aaab5c0b7aa7682e44bd325ecfc646a9e265d172cda656148539779fc8f64ed899aca0a9843f0911aaf99
|
7
|
+
data.tar.gz: 76ed30a81fd6db211c7580cedd6875ad922ae0aa9248b5e93cfeebd81988a75bd838b3816f2e5124a0331177028e64587b3c0f418de0db64d0f91b5f126a240e
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Checks
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- name: Set up Ruby 2.7
|
12
|
+
uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: 2.7
|
15
|
+
- name: Cache gems
|
16
|
+
uses: actions/cache@v1
|
17
|
+
with:
|
18
|
+
path: vendor/bundle
|
19
|
+
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
|
20
|
+
restore-keys: |
|
21
|
+
${{ runner.os }}-rubocop-
|
22
|
+
- name: Install gems
|
23
|
+
run: |
|
24
|
+
bundle config path vendor/bundle
|
25
|
+
bundle config set without 'default doc job cable storage ujs test db'
|
26
|
+
bundle install --jobs 4 --retry 3
|
27
|
+
gem install rubocop
|
28
|
+
- name: Rubocop
|
29
|
+
run: rubocop --format simple --parallel --config .rubocop.yml --fail-level W
|
data/.gitignore
ADDED
data/.idea/.gitignore
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/omniauth-fera.iml" filepath="$PROJECT_DIR$/.idea/omniauth-fera.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="jdk" jdkName="rbenv: 2.7.6" jdkType="RUBY_SDK" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.3.1, rbenv: 2.7.6) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 2.7.6) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.3, rbenv: 2.7.6) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10, rbenv: 2.7.6) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="faraday (v2.4.0, rbenv: 2.7.6) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="faraday-net_http (v2.1.0, rbenv: 2.7.6) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="hashie (v5.0.0, rbenv: 2.7.6) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.12.0, rbenv: 2.7.6) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.2, rbenv: 2.7.6) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="jwt (v2.4.1, rbenv: 2.7.6) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.16.2, rbenv: 2.7.6) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.7.6) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="oauth2 (v2.0.6, rbenv: 2.7.6) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="omniauth (v2.1.0, rbenv: 2.7.6) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="omniauth-oauth2 (v1.8.0, rbenv: 2.7.6) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, rbenv: 2.7.6) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, rbenv: 2.7.6) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="rack (v2.2.4, rbenv: 2.7.6) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-protection (v2.2.2, rbenv: 2.7.6) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 2.7.6) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="rash_alt (v0.4.12, rbenv: 2.7.6) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.5.0, rbenv: 2.7.6) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, rbenv: 2.7.6) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.32.0, rbenv: 2.7.6) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.19.1, rbenv: 2.7.6) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, rbenv: 2.7.6) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby2_keywords (v0.0.5, rbenv: 2.7.6) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.5, rbenv: 2.7.6) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.2.0, rbenv: 2.7.6) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="version_gem (v1.1.0, rbenv: 2.7.6) [gem]" level="application" />
|
44
|
+
</component>
|
45
|
+
<component name="RakeTasksCache">
|
46
|
+
<option name="myRootTask">
|
47
|
+
<RakeTaskImpl id="rake" />
|
48
|
+
</option>
|
49
|
+
</component>
|
50
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Style/StringLiterals:
|
2
|
+
Enabled: true
|
3
|
+
EnforcedStyle: double_quotes
|
4
|
+
Style/StringLiteralsInInterpolation:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
Style/FrozenStringLiteralComment:
|
8
|
+
Enabled: false
|
9
|
+
Layout/LeadingCommentSpace:
|
10
|
+
Enabled: false
|
11
|
+
Layout/LineLength:
|
12
|
+
Max: 200
|
13
|
+
# If AbcSize > 50, really really really really really really really complex
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Max: 50
|
16
|
+
# Use the default setting
|
17
|
+
Metrics/BlockNesting:
|
18
|
+
Enabled: true
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Max: 200
|
21
|
+
Exclude:
|
22
|
+
# RuboCop's default
|
23
|
+
- 'Rakefile'
|
24
|
+
- '**/*.rake'
|
25
|
+
- 'spec/**/*.rb'
|
26
|
+
# In many cases, config/routes.rb has very long blocks
|
27
|
+
- 'config/routes.rb'
|
28
|
+
Metrics/ClassLength:
|
29
|
+
Enabled: false
|
30
|
+
Metrics/CyclomaticComplexity:
|
31
|
+
Max: 30
|
32
|
+
Metrics/MethodLength:
|
33
|
+
Enabled: false
|
34
|
+
Metrics/ModuleLength:
|
35
|
+
Enabled: false
|
36
|
+
Metrics/ParameterLists:
|
37
|
+
Enabled: true
|
38
|
+
Max: 4
|
39
|
+
Metrics/PerceivedComplexity:
|
40
|
+
Enabled: false
|
41
|
+
Layout/TrailingEmptyLines:
|
42
|
+
Enabled: false
|
43
|
+
Layout/TrailingWhitespace:
|
44
|
+
Enabled: false
|
45
|
+
Layout/BlockAlignment:
|
46
|
+
Enabled: false
|
47
|
+
Layout/DefEndAlignment:
|
48
|
+
Enabled: false
|
49
|
+
Layout/EndAlignment:
|
50
|
+
Enabled: false
|
51
|
+
Layout/ClosingHeredocIndentation:
|
52
|
+
Enabled: false
|
53
|
+
Layout/LeadingEmptyLines:
|
54
|
+
Enabled: false
|
55
|
+
Layout/SpaceInsideStringInterpolation:
|
56
|
+
EnforcedStyle: space
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at najibkaake@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-fera (0.1.0)
|
5
|
+
activesupport
|
6
|
+
bundler (>= 1.15.0)
|
7
|
+
omniauth (>= 1.9)
|
8
|
+
omniauth-oauth2 (>= 1)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activesupport (7.0.3.1)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
ast (2.4.2)
|
19
|
+
concurrent-ruby (1.1.10)
|
20
|
+
faraday (2.4.0)
|
21
|
+
faraday-net_http (~> 2.0)
|
22
|
+
ruby2_keywords (>= 0.0.4)
|
23
|
+
faraday-net_http (2.1.0)
|
24
|
+
hashie (5.0.0)
|
25
|
+
i18n (1.12.0)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
json (2.6.2)
|
28
|
+
jwt (2.4.1)
|
29
|
+
minitest (5.16.2)
|
30
|
+
multi_xml (0.6.0)
|
31
|
+
oauth2 (2.0.6)
|
32
|
+
faraday (>= 0.17.3, < 3.0)
|
33
|
+
jwt (>= 1.0, < 3.0)
|
34
|
+
multi_xml (~> 0.5)
|
35
|
+
rack (>= 1.2, < 3)
|
36
|
+
rash_alt (>= 0.4, < 1)
|
37
|
+
version_gem (~> 1.1)
|
38
|
+
omniauth (2.1.0)
|
39
|
+
hashie (>= 3.4.6)
|
40
|
+
rack (>= 2.2.3)
|
41
|
+
rack-protection
|
42
|
+
omniauth-oauth2 (1.8.0)
|
43
|
+
oauth2 (>= 1.4, < 3)
|
44
|
+
omniauth (~> 2.0)
|
45
|
+
parallel (1.22.1)
|
46
|
+
parser (3.1.2.0)
|
47
|
+
ast (~> 2.4.1)
|
48
|
+
rack (2.2.4)
|
49
|
+
rack-protection (2.2.2)
|
50
|
+
rack
|
51
|
+
rainbow (3.1.1)
|
52
|
+
rash_alt (0.4.12)
|
53
|
+
hashie (>= 3.4)
|
54
|
+
regexp_parser (2.5.0)
|
55
|
+
rexml (3.2.5)
|
56
|
+
rubocop (1.32.0)
|
57
|
+
json (~> 2.3)
|
58
|
+
parallel (~> 1.10)
|
59
|
+
parser (>= 3.1.0.0)
|
60
|
+
rainbow (>= 2.2.2, < 4.0)
|
61
|
+
regexp_parser (>= 1.8, < 3.0)
|
62
|
+
rexml (>= 3.2.5, < 4.0)
|
63
|
+
rubocop-ast (>= 1.19.1, < 2.0)
|
64
|
+
ruby-progressbar (~> 1.7)
|
65
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
66
|
+
rubocop-ast (1.19.1)
|
67
|
+
parser (>= 3.1.1.0)
|
68
|
+
ruby-progressbar (1.11.0)
|
69
|
+
ruby2_keywords (0.0.5)
|
70
|
+
tzinfo (2.0.5)
|
71
|
+
concurrent-ruby (~> 1.0)
|
72
|
+
unicode-display_width (2.2.0)
|
73
|
+
version_gem (1.1.0)
|
74
|
+
|
75
|
+
PLATFORMS
|
76
|
+
x86_64-darwin-18
|
77
|
+
x86_64-darwin-20
|
78
|
+
|
79
|
+
DEPENDENCIES
|
80
|
+
omniauth-fera!
|
81
|
+
rack (>= 2.2.3.1)
|
82
|
+
rubocop (>= 1.25.1)
|
83
|
+
|
84
|
+
BUNDLED WITH
|
85
|
+
2.2.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Fera Commerce Inc
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Omniauth::Fera
|
2
|
+
|
3
|
+
This gem adds the omniauth authentication strategy for [Fera Partner Apps](https://partners.fera.ai/partner-portal/apps).
|
4
|
+
|
5
|
+
To authenticate your partner app on your own follow the instructions in [our developer docs here](https://developers.fera.ai/docs/partners-app-authentication).
|
6
|
+
|
7
|
+
# Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniauth-fera', '~> 0.1'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
|
20
|
+
# Setup
|
21
|
+
Add this code to your initializer if you're using Rails (`config/initializers/fera.rb`) or somewhere else if you're not.
|
22
|
+
```ruby
|
23
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
24
|
+
provider :fera,
|
25
|
+
ENV['FERA_CLIENT_ID'], # Or replace with your Fera app API client ID
|
26
|
+
ENV['FERA_CLIENT_SECRET'], # Or replace with your Fera app API client secret
|
27
|
+
callback_url: ENV['FERA_REDIRECT_URI'], # Something like https://www.example.com/auth/fera/callback and should Fera App settings
|
28
|
+
scope: 'read write' # If you're only reading data then omit the 'write' scope.
|
29
|
+
end
|
30
|
+
```
|
31
|
+
You can find your client ID, client secret and redirect URI in the [Fera partner app edit screen](https://developers.fera.ai/docs/partners-app-authentication).
|
32
|
+
|
33
|
+
# Usage
|
34
|
+
After doing the above and rebooting your rack-based web server you can follow the same conventions as found in the
|
35
|
+
[OmniAuth gem docs here](https://github.com/omniauth/omniauth).
|
36
|
+
|
37
|
+
That just means:
|
38
|
+
1. You can start an authentication flow by going to /auth/fera
|
39
|
+
2. You need to implement/route `/auth/fera/callback` to a controller action or something similar for your framework.
|
40
|
+
3. Within you can grab the auth token from `request.env['omniauth.auth']['credentials']['token']` like this:
|
41
|
+
```ruby
|
42
|
+
auth_token = request.env['omniauth.auth']['credentials']['token']
|
43
|
+
```
|
44
|
+
Save this token value to your database so you can use it later.
|
45
|
+
|
46
|
+
BTW, you'll also receive `store_id`, `store_domain`, `owner_email` and `store_public_key` for your convenience in the GET params of the callback.
|
47
|
+
|
48
|
+
|
49
|
+
Your auth token (AKA access token, AKA auth key) can be used as an API key to access the
|
50
|
+
[Fera Private API documented here](https://developers.fera.ai/reference/authentication).
|
51
|
+
|
52
|
+
### Pre-setting the store/shop
|
53
|
+
If you already know the Fera account, domain or store you want to connect to in your app you can pass the `?shop` parameter
|
54
|
+
with the authentication request like this:
|
55
|
+
* `/auth/fera?shop=example.myshopify.com` (canonical domain), or
|
56
|
+
* `/auth/fera?shop=fsto_someStoreId123` (Fera ID), or
|
57
|
+
* `/auth/fera?shop=example.com` (vanity domain), or
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
Once you have an auth key you can use the Fera API easily through the [Fera API gem](https://github.com/feracommerce/fera-api-ruby) like this:
|
62
|
+
```ruby
|
63
|
+
Fera::API.configure(auth_token) do
|
64
|
+
Fera::Review.all # Returns all reviews from the authorized account/store.
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
# Contributing
|
69
|
+
|
70
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/feracommerce/omniauth-fera.
|
71
|
+
|
72
|
+
|
73
|
+
### How to contribute
|
74
|
+
To contribute to the repository:
|
75
|
+
|
76
|
+
1. Fork the repository.
|
77
|
+
2. Clone the forked repository locally.
|
78
|
+
3. Create a branch descriptive of your work. For example "my_new_feature_xyz".
|
79
|
+
4. When you're done work, push up that branch to **your own forked repository** (not the main one).
|
80
|
+
5. Visit https://github.com/feracommerce/omniauth-fera and you'll see an option to create a pull request from your forked branch to the master. Create a pull request.
|
81
|
+
|
82
|
+
# License
|
83
|
+
|
84
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "omniauth/fera"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Fera < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options,
|
7
|
+
site: ENV['FERA_APP_URL'].presence || ENV['FERA_PROVIDER_URL'].presence || 'https://app.fera.ai'
|
8
|
+
|
9
|
+
option :setup, proc { |env|
|
10
|
+
request = Rack::Request.new(env)
|
11
|
+
allowed_get_params = request.GET.slice('shop', 'store', 'id', 'public_key', 'store_pk', 'store_public_key', 'pk', 'store_id', 'shop_id')
|
12
|
+
request.env['omniauth.params'] = env['omniauth.params'].to_h.merge(allowed_get_params)
|
13
|
+
}
|
14
|
+
|
15
|
+
def callback_url
|
16
|
+
options[:callback_url] || full_host + script_name + callback_path
|
17
|
+
end
|
18
|
+
|
19
|
+
def authorize_params
|
20
|
+
super.merge(request.GET.slice('shop', 'store', 'id', 'public_key', 'store_pk', 'store_public_key', 'pk', 'store_id', 'shop_id'))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'omniauth/fera'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
$:.push File.expand_path('../lib', __FILE__)
|
4
|
+
require 'omniauth/fera/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-fera"
|
8
|
+
spec.version = OmniAuth::Fera::VERSION
|
9
|
+
spec.authors = ["Fera Commerce Inc"]
|
10
|
+
spec.email = ["developers@fera.ai"]
|
11
|
+
|
12
|
+
spec.summary = "OmniAuth strategy for Fera apps."
|
13
|
+
spec.description = "OmniAuth strategy for Fera apps."
|
14
|
+
spec.homepage = "https://www.fera.ai"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split("\n")
|
19
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
|
24
|
+
spec.add_dependency "bundler", ">= 1.15.0"
|
25
|
+
|
26
|
+
spec.add_runtime_dependency 'omniauth', '>= 1.9'
|
27
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '>= 1'
|
28
|
+
spec.add_runtime_dependency 'activesupport'
|
29
|
+
end
|
30
|
+
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-fera
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fera Commerce Inc
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.15.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.15.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.9'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: omniauth-oauth2
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: OmniAuth strategy for Fera apps.
|
70
|
+
email:
|
71
|
+
- developers@fera.ai
|
72
|
+
executables:
|
73
|
+
- console
|
74
|
+
- setup
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".github/workflows/checks.yml"
|
79
|
+
- ".gitignore"
|
80
|
+
- ".idea/.gitignore"
|
81
|
+
- ".idea/modules.xml"
|
82
|
+
- ".idea/omniauth-fera.iml"
|
83
|
+
- ".idea/vcs.xml"
|
84
|
+
- ".rubocop.yml"
|
85
|
+
- CODE_OF_CONDUCT.md
|
86
|
+
- Gemfile
|
87
|
+
- Gemfile.lock
|
88
|
+
- LICENSE.txt
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- bin/console
|
92
|
+
- bin/setup
|
93
|
+
- lib/omniauth-fera.rb
|
94
|
+
- lib/omniauth/fera.rb
|
95
|
+
- lib/omniauth/fera/version.rb
|
96
|
+
- lib/omniauth/strategies/fera.rb
|
97
|
+
- omniauth-fera.gemspec
|
98
|
+
homepage: https://www.fera.ai
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.3.0
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubygems_version: 3.1.6
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: OmniAuth strategy for Fera apps.
|
121
|
+
test_files: []
|