omniauth-authify 0.1.1
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 +7 -0
- data/.release-please-manifest.json +3 -0
- data/.rspec +3 -0
- data/.rubocop.yml +94 -0
- data/.ruby-version +1 -0
- data/.tool-versions +1 -0
- data/.yardopts +5 -0
- data/AGENTS.md +51 -0
- data/CHANGELOG.md +17 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +45 -0
- data/LICENSE.txt +21 -0
- data/README.md +123 -0
- data/Rakefile +24 -0
- data/lib/omniauth/authify/errors.rb +12 -0
- data/lib/omniauth/authify/jwt_validator.rb +237 -0
- data/lib/omniauth/authify/version.rb +7 -0
- data/lib/omniauth/authify.rb +18 -0
- data/lib/omniauth/strategies/authify.rb +287 -0
- data/lib/omniauth-authify.rb +3 -0
- data/release-please-config.json +15 -0
- data/sig/omniauth/authify.rbs +86 -0
- data/sig/omniauth/strategies/authify.rbs +78 -0
- data/sig/shims.rbs +67 -0
- metadata +262 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b98af8a5b5ebd4d40b6c6ee05742ae7716a32180b9b562911f1b33ab89415aa1
|
|
4
|
+
data.tar.gz: 9951fafe6fcfa93723ef89916dc608f21a2fba12350b2a33ed28d820b0052e63
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 110354e211dca1c4123f483b067a23d5b93b62f2fabb2d645db988f6023d1c894778aaff46e66696219d06a1be886c4c1b395645e7dc389847d33035d8167b9a
|
|
7
|
+
data.tar.gz: a6684f67a7eb0e1bd55f8fbb4f416f9ee4ae483ce82998c84e1eae958f10c514e1273c20b980c834eff9a14f0fc2961273a9b740a0beb20ef1e0679042d4030f
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rake
|
|
3
|
+
- rubocop-rspec
|
|
4
|
+
|
|
5
|
+
Layout/LineLength:
|
|
6
|
+
Max: 100
|
|
7
|
+
|
|
8
|
+
AllCops:
|
|
9
|
+
TargetRubyVersion: 3.4
|
|
10
|
+
Exclude:
|
|
11
|
+
- 'vendor/**/*'
|
|
12
|
+
NewCops: enable
|
|
13
|
+
|
|
14
|
+
Metrics/AbcSize:
|
|
15
|
+
Max: 21
|
|
16
|
+
Exclude:
|
|
17
|
+
- 'spec/support/*'
|
|
18
|
+
|
|
19
|
+
Metrics/BlockLength:
|
|
20
|
+
Max: 35
|
|
21
|
+
Exclude:
|
|
22
|
+
- 'spec/**/*_spec.rb'
|
|
23
|
+
- 'spec/support/*.rb'
|
|
24
|
+
- 'Rakefile'
|
|
25
|
+
- '*.gemspec'
|
|
26
|
+
|
|
27
|
+
Metrics/CyclomaticComplexity:
|
|
28
|
+
Max: 12
|
|
29
|
+
|
|
30
|
+
Metrics/MethodLength:
|
|
31
|
+
Max: 25
|
|
32
|
+
|
|
33
|
+
Metrics/ModuleLength:
|
|
34
|
+
Max: 160
|
|
35
|
+
Exclude:
|
|
36
|
+
- 'spec/**/*_spec.rb'
|
|
37
|
+
|
|
38
|
+
Metrics/ClassLength:
|
|
39
|
+
Max: 300
|
|
40
|
+
Exclude:
|
|
41
|
+
- 'spec/**/*_spec.rb'
|
|
42
|
+
|
|
43
|
+
Metrics/ParameterLists:
|
|
44
|
+
Max: 6
|
|
45
|
+
Exclude:
|
|
46
|
+
- 'spec/support/*'
|
|
47
|
+
|
|
48
|
+
Gemspec/RequireMFA:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
Gemspec/DevelopmentDependencies:
|
|
52
|
+
Enabled: false
|
|
53
|
+
|
|
54
|
+
Style/MixinUsage:
|
|
55
|
+
Exclude:
|
|
56
|
+
- "bin/console"
|
|
57
|
+
|
|
58
|
+
Style/StringLiterals:
|
|
59
|
+
Enabled: true
|
|
60
|
+
EnforcedStyle: double_quotes
|
|
61
|
+
|
|
62
|
+
Style/StringLiteralsInInterpolation:
|
|
63
|
+
Enabled: true
|
|
64
|
+
EnforcedStyle: double_quotes
|
|
65
|
+
|
|
66
|
+
Style/StringConcatenation:
|
|
67
|
+
Exclude:
|
|
68
|
+
- 'Rakefile'
|
|
69
|
+
|
|
70
|
+
Naming/FileName:
|
|
71
|
+
Exclude:
|
|
72
|
+
- 'lib/omniauth-authify.rb'
|
|
73
|
+
|
|
74
|
+
RSpec/SpecFilePathFormat:
|
|
75
|
+
CustomTransform:
|
|
76
|
+
OmniAuth: omni_auth
|
|
77
|
+
|
|
78
|
+
# The smoke harness (spec/smoke) is standalone tooling driven by bash and
|
|
79
|
+
# ruby-one-offs, not an RSpec suite; treat it as regular Ruby.
|
|
80
|
+
RSpec:
|
|
81
|
+
Exclude:
|
|
82
|
+
- 'spec/smoke/**/*'
|
|
83
|
+
|
|
84
|
+
RSpec/NamedSubject:
|
|
85
|
+
Enabled: false
|
|
86
|
+
|
|
87
|
+
RSpec/MultipleMemoizedHelpers:
|
|
88
|
+
Max: 12
|
|
89
|
+
|
|
90
|
+
RSpec/MultipleExpectations:
|
|
91
|
+
Max: 13
|
|
92
|
+
|
|
93
|
+
RSpec/ExampleLength:
|
|
94
|
+
Max: 40
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.10
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.4.10
|
data/.yardopts
ADDED
data/AGENTS.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidelines for AI agents and automated tools working in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
omniauth-authify is an [OmniAuth](https://github.com/omniauth/omniauth) strategy for
|
|
8
|
+
[Authify](https://github.com/authify/authify), a self-hosted, multi-tenant identity provider.
|
|
9
|
+
It implements the OpenID Connect authorization code flow with PKCE and verifies ID tokens
|
|
10
|
+
against the organization's JWKS.
|
|
11
|
+
|
|
12
|
+
- **Language**: Ruby 3.4+ (via asdf, see `.tool-versions` / `.ruby-version`)
|
|
13
|
+
- **Framework**: OmniAuth 2.x strategy built on omniauth-oauth2 / oauth2
|
|
14
|
+
- **Testing**: RSpec with WebMock
|
|
15
|
+
- **Docs**: YARD
|
|
16
|
+
- **Linting**: RuboCop (rubocop-rake, rubocop-rspec)
|
|
17
|
+
- **Releases**: Automated via release-please on push to `main`
|
|
18
|
+
|
|
19
|
+
## Quality Gates
|
|
20
|
+
|
|
21
|
+
All four must pass before opening a PR. These run in CI (`.github/workflows/ci.yml`):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bundle exec rubocop # Style/lint
|
|
25
|
+
bundle exec rake spec # Unit tests
|
|
26
|
+
bundle exec rake rbs # Signature validation (sig/**/*.rbs)
|
|
27
|
+
bundle exec rake yard # YARD documentation generation
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Constraints
|
|
31
|
+
|
|
32
|
+
- **Do not edit** `lib/omniauth/authify/version.rb` or `CHANGELOG.md`. These are managed by release-please.
|
|
33
|
+
- **Do not add runtime dependencies** without explicit justification. The gemspec is deliberately curated.
|
|
34
|
+
- **Do not suppress RuboCop cops inline** without a stated reason. Fix the code or adjust `.rubocop.yml` if a project-wide change is warranted.
|
|
35
|
+
- **Security-critical areas** — Changes to `lib/omniauth/authify/jwt_validator.rb`, nonce/PKCE handling, or any signature/claim verification logic must include test coverage for both success and failure paths.
|
|
36
|
+
- **Respect existing structure** — The strategy lives in `lib/omniauth/strategies/authify.rb`; supporting classes live under `lib/omniauth/authify/`.
|
|
37
|
+
|
|
38
|
+
## Conventions
|
|
39
|
+
|
|
40
|
+
- **Conventional Commits** — `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`. Release-please generates changelogs from commit messages, so this is functional, not cosmetic.
|
|
41
|
+
- **Double-quoted strings** — Enforced by `.rubocop.yml` (`Style/StringLiterals`).
|
|
42
|
+
- **100-character line length** — Enforced by RuboCop (`Layout/LineLength`).
|
|
43
|
+
- **Ruby 3.4 target** — Use modern Ruby syntax; don't add compatibility shims for older versions.
|
|
44
|
+
|
|
45
|
+
## Workflow
|
|
46
|
+
|
|
47
|
+
1. **Plan before code.** Produce a design or plan before writing implementation code.
|
|
48
|
+
2. **Tests first.** Write or update tests before or alongside implementation.
|
|
49
|
+
3. **Minimal viable output.** Produce focused artifacts with clear structure. Don't over-engineer or add scope beyond the task.
|
|
50
|
+
4. **Run all quality gates** before declaring work complete.
|
|
51
|
+
5. **Respect project boundaries** defined in this file and in `CONTRIBUTING.md`.
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [0.1.1](https://github.com/authify/omniauth-authify/compare/omniauth-authify-v0.1.0...omniauth-authify/v0.1.1) (2026-08-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* initial release of the omniauth-authify strategy ([73b3aaa](https://github.com/authify/omniauth-authify/commit/73b3aaa199d826365f304da5f84aeea2710b5966))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **ci:** correct dead failure-path assertion and rate-limit flakiness ([a0ac070](https://github.com/authify/omniauth-authify/commit/a0ac07098bde3b5b489801bf8e2c5323db7583ae))
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-08-29
|
|
16
|
+
|
|
17
|
+
- Initial release
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## How to Contribute Code
|
|
4
|
+
|
|
5
|
+
I'm so glad you're reading this, because we need volunteer developers to help this project grow and thrive!
|
|
6
|
+
|
|
7
|
+
Before you begin, ensure that your contribution is associated with a [GitHub issue](https://github.com/authify/omniauth-authify/issues). If there isn't an existing issue, please create one.
|
|
8
|
+
|
|
9
|
+
1. Fork the repository
|
|
10
|
+
2. Create a new branch (`git checkout -b feature-branch`)
|
|
11
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
12
|
+
4. Push to the branch (`git push origin feature-branch`)
|
|
13
|
+
5. Create a new [Pull Request](http://help.github.com/pull-requests/)
|
|
14
|
+
|
|
15
|
+
## Testing
|
|
16
|
+
|
|
17
|
+
Please make sure that your code passes the existing tests and add tests for any new functionality. Please write [RSpec](https://rspec.info/) examples for new features you add or modify.
|
|
18
|
+
|
|
19
|
+
To execute the tests, run `bundle exec rake spec`.
|
|
20
|
+
|
|
21
|
+
## Coding Style
|
|
22
|
+
|
|
23
|
+
This project uses [Rubocop](https://rubocop.org/) to enforce a consistent coding style. Please make sure that your code passes the Rubocop checks.
|
|
24
|
+
|
|
25
|
+
To execute Rubocop, run `bundle exec rake rubocop`.
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
Please make sure that your code is well documented. If you add new features, please add documentation for them. This project uses [YARD](https://yardoc.org/) for documentation, so please add YARD tags to your code when appropriate.
|
|
30
|
+
|
|
31
|
+
To generate the documentation locally, run `bundle exec rake yard`.
|
|
32
|
+
|
|
33
|
+
## Security
|
|
34
|
+
|
|
35
|
+
Since this gem sits in an authentication path, treat security issues with care: signature verification, claim validation, nonce handling, and PKCE logic changes should always include test coverage for both the success and failure paths.
|
|
36
|
+
|
|
37
|
+
Please report security vulnerabilities privately to the maintainers rather than opening a public issue.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
By contributing your code, you agree to license your contribution under the terms of the [MIT License](LICENSE.txt).
|
|
42
|
+
|
|
43
|
+
## Code of Conduct
|
|
44
|
+
|
|
45
|
+
By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md).
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jonathan Gnagy
|
|
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,123 @@
|
|
|
1
|
+
# OmniAuth::Authify
|
|
2
|
+
|
|
3
|
+
An [OmniAuth](https://github.com/omniauth/omniauth) strategy for
|
|
4
|
+
[Authify](https://github.com/authify/authify), a self-hosted, open-source,
|
|
5
|
+
multi-tenant identity provider implementing OpenID Connect on top of
|
|
6
|
+
OAuth 2.0.
|
|
7
|
+
|
|
8
|
+
The strategy implements the OpenID Connect authorization code flow with
|
|
9
|
+
PKCE (S256), verifies the returned ID token's signature against the
|
|
10
|
+
organization's published JWKS, and validates the standard ID token claims
|
|
11
|
+
including the per-login nonce.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gem install omniauth-authify
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
or in your `Gemfile`:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
gem "omniauth-authify"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Because Authify is multi-tenant, both the server base URL (`:site`) and the
|
|
28
|
+
`:organization` slug are required. Register an OAuth2 application for your
|
|
29
|
+
client in the Authify dashboard (or via the Management API), then configure
|
|
30
|
+
the provider with its `client_id` and `client_secret`.
|
|
31
|
+
|
|
32
|
+
### Rails (Devise or plain OmniAuth)
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
# config/initializers/omniauth.rb
|
|
36
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
|
37
|
+
provider :authify,
|
|
38
|
+
ENV["AUTHIFY_CLIENT_ID"],
|
|
39
|
+
ENV["AUTHIFY_CLIENT_SECRET"],
|
|
40
|
+
site: "https://authify.example.com",
|
|
41
|
+
organization: "my-org"
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Sinatra
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
require "omniauth-authify"
|
|
49
|
+
|
|
50
|
+
use OmniAuth::Builder do
|
|
51
|
+
provider :authify, ENV["AUTHIFY_CLIENT_ID"], ENV["AUTHIFY_CLIENT_SECRET"],
|
|
52
|
+
site: "https://authify.example.com", organization: "my-org"
|
|
53
|
+
end
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Note that OmniAuth 2.x only accepts POST requests to `/auth/:provider` by
|
|
57
|
+
default; use something like `omniauth-rails_csrf_protection` in Rails apps.
|
|
58
|
+
|
|
59
|
+
## Options
|
|
60
|
+
|
|
61
|
+
| Option | Default | Description |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `site` | — | **Required.** Base URL of the Authify server |
|
|
64
|
+
| `organization` | — | **Required.** Organization slug within Authify |
|
|
65
|
+
| `scope` | `openid profile email` | Requested scopes. `openid` is required for ID token issuance |
|
|
66
|
+
| `pkce` | `true` | Use the authorization code flow with PKCE (S256) |
|
|
67
|
+
| `verify_id_token` | `true` | Verify the ID token signature (via the org JWKS) and claims |
|
|
68
|
+
| `leeway` | `60` | Clock skew allowance (seconds) when validating time claims |
|
|
69
|
+
| `client_options` | `{}` | Passed through to the underlying `OAuth2::Client` |
|
|
70
|
+
|
|
71
|
+
## Auth Hash
|
|
72
|
+
|
|
73
|
+
The strategy exposes the standard OmniAuth auth hash:
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
{
|
|
77
|
+
provider: "authify",
|
|
78
|
+
uid: "12345678", # the user's immutable `sub` claim
|
|
79
|
+
info: {
|
|
80
|
+
name: "Jane User",
|
|
81
|
+
email: "jane@example.com",
|
|
82
|
+
image: "https://…/avatar.png",
|
|
83
|
+
nickname: "jane@example.com",
|
|
84
|
+
first_name: "Jane",
|
|
85
|
+
last_name: "User",
|
|
86
|
+
location: "America/Chicago",
|
|
87
|
+
phone: "+15551234567",
|
|
88
|
+
urls: { website: "https://example.com/jane" }
|
|
89
|
+
},
|
|
90
|
+
credentials: {
|
|
91
|
+
token: "ACCESS_TOKEN",
|
|
92
|
+
refresh_token: "REFRESH_TOKEN",
|
|
93
|
+
expires_at: 1700000000,
|
|
94
|
+
expires: true,
|
|
95
|
+
id_token: "eyJhbGciOiJSUzI1NiIs…"
|
|
96
|
+
},
|
|
97
|
+
extra: {
|
|
98
|
+
raw_info: { … }, # verified ID token claims (or userinfo response)
|
|
99
|
+
id_info: { … } # verified ID token claims, when verification is enabled
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Authify application setup
|
|
105
|
+
|
|
106
|
+
1. Sign in to your Authify organization and create an OAuth2 application.
|
|
107
|
+
2. Register your client's callback URL (e.g.
|
|
108
|
+
`https://your.app/auth/authify/callback`) as an allowed redirect URI.
|
|
109
|
+
3. Grant the application at least the `openid` scope (plus `profile`,
|
|
110
|
+
`email`, `groups`, or `phone` as needed).
|
|
111
|
+
|
|
112
|
+
Contributing
|
|
113
|
+
------------
|
|
114
|
+
|
|
115
|
+
If you're interested in contributing, please see the
|
|
116
|
+
[Contributing Guide](CONTRIBUTING.md) in the repository! Be sure to check out
|
|
117
|
+
the [Code of Conduct](CODE_OF_CONDUCT.md) as well!
|
|
118
|
+
|
|
119
|
+
License
|
|
120
|
+
-------
|
|
121
|
+
|
|
122
|
+
The gem is available as open source under the terms of the
|
|
123
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
ENV["RACK_ENV"] ||= "test"
|
|
4
|
+
|
|
5
|
+
require "bundler/gem_tasks"
|
|
6
|
+
require "rspec/core/rake_task"
|
|
7
|
+
require "rubocop/rake_task"
|
|
8
|
+
require "yard"
|
|
9
|
+
|
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
11
|
+
RuboCop::RakeTask.new
|
|
12
|
+
YARD::Rake::YardocTask.new
|
|
13
|
+
|
|
14
|
+
desc "Validate the RBS signatures in sig/"
|
|
15
|
+
task :rbs do
|
|
16
|
+
sh "bundle exec rbs -r net-http -I sig validate"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
desc "Run a walkthrough console with the strategy loaded"
|
|
20
|
+
task :console do
|
|
21
|
+
exec "bundle exec irb -I lib -r omniauth-authify"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
task default: %i[spec rubocop rbs yard]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OmniAuth
|
|
4
|
+
module Authify
|
|
5
|
+
# Raised for configuration errors within the strategy itself
|
|
6
|
+
class ConfigurationError < StandardError; end
|
|
7
|
+
|
|
8
|
+
# Raised when an Authify-issued ID token (or the signing keys used to
|
|
9
|
+
# verify it) cannot be validated.
|
|
10
|
+
class TokenValidationError < StandardError; end
|
|
11
|
+
end
|
|
12
|
+
end
|