omniauth-tipalti 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ce3ba078add86f383ff98c6c7f3ed6399bfd174dce152f40567aab50fa8eaae0
4
+ data.tar.gz: 7af735ab4cea723c1507d74af57f63e03a2a4d981a038e4b992197446c42be87
5
+ SHA512:
6
+ metadata.gz: 503883ab328a1d22f2b2029cdd4383ea0082992257feac9bef652cd0ae6ce11c19d9993fec5a4af7a98ef13852e40a9962a425ba3d6402516674c2a60899ced4
7
+ data.tar.gz: 4504988a2e8e95bfd302fc6b9b325edd61d71b97e29b8408415f2907d64e4c10bc50eb45ffbf6d4edf70f6d56ffa8fa427467341fbadd3c484df16356b1ba170
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,51 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ AllCops:
5
+ NewCops: enable
6
+ SuggestExtensions: false
7
+ TargetRubyVersion: 2.6
8
+
9
+ Metrics/BlockLength:
10
+ Enabled: true
11
+ Exclude:
12
+ - spec/**/*
13
+
14
+ Naming/FileName:
15
+ Enabled: true
16
+ Exclude:
17
+ - lib/omniauth-tipalti.rb
18
+
19
+ RSpec/ExampleLength:
20
+ Enabled: false
21
+
22
+ RSpec/FilePath:
23
+ Enabled: true
24
+ Exclude:
25
+ - spec/omniauth/strategies/tipalti_spec.rb
26
+
27
+ RSpec/InstanceVariable:
28
+ Enabled: false
29
+
30
+ RSpec/MultipleMemoizedHelpers:
31
+ Enabled: false
32
+
33
+ RSpec/SubjectStub:
34
+ Enabled: false
35
+
36
+ RSpec/VerifiedDoubles:
37
+ Enabled: false
38
+
39
+ Style/Documentation:
40
+ Enabled: false
41
+
42
+ Style/StringLiterals:
43
+ Enabled: true
44
+ EnforcedStyle: double_quotes
45
+
46
+ Style/StringLiteralsInInterpolation:
47
+ Enabled: true
48
+ EnforcedStyle: double_quotes
49
+
50
+ Layout/LineLength:
51
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ ## [Unreleased]
@@ -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 me@jordanell.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
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "omniauth", "~> 2.1.1"
6
+ gem "omniauth-oauth2", "~> 1.8.0"
7
+
8
+ group :development, :test do
9
+ gem "rake", "~> 13.0.6"
10
+ gem "rspec", "~> 3.12.0"
11
+ gem "rspec_junit_formatter", "~> 0.6.0"
12
+ gem "rubocop", "~> 1.52.1"
13
+ gem "rubocop-rspec", "~> 2.22.0"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ast (2.4.2)
5
+ diff-lcs (1.5.0)
6
+ faraday (2.7.6)
7
+ faraday-net_http (>= 2.0, < 3.1)
8
+ ruby2_keywords (>= 0.0.4)
9
+ faraday-net_http (3.0.2)
10
+ hashie (5.0.0)
11
+ json (2.6.3)
12
+ jwt (2.7.1)
13
+ multi_xml (0.6.0)
14
+ oauth2 (2.0.9)
15
+ faraday (>= 0.17.3, < 3.0)
16
+ jwt (>= 1.0, < 3.0)
17
+ multi_xml (~> 0.5)
18
+ rack (>= 1.2, < 4)
19
+ snaky_hash (~> 2.0)
20
+ version_gem (~> 1.1)
21
+ omniauth (2.1.1)
22
+ hashie (>= 3.4.6)
23
+ rack (>= 2.2.3)
24
+ rack-protection
25
+ omniauth-oauth2 (1.8.0)
26
+ oauth2 (>= 1.4, < 3)
27
+ omniauth (~> 2.0)
28
+ parallel (1.23.0)
29
+ parser (3.2.2.3)
30
+ ast (~> 2.4.1)
31
+ racc
32
+ racc (1.7.1)
33
+ rack (3.0.8)
34
+ rack-protection (3.0.6)
35
+ rack
36
+ rainbow (3.1.1)
37
+ rake (13.0.6)
38
+ regexp_parser (2.8.1)
39
+ rexml (3.2.5)
40
+ rspec (3.12.0)
41
+ rspec-core (~> 3.12.0)
42
+ rspec-expectations (~> 3.12.0)
43
+ rspec-mocks (~> 3.12.0)
44
+ rspec-core (3.12.2)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-expectations (3.12.3)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-mocks (3.12.5)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-support (3.12.1)
53
+ rspec_junit_formatter (0.6.0)
54
+ rspec-core (>= 2, < 4, != 2.12.0)
55
+ rubocop (1.52.1)
56
+ json (~> 2.3)
57
+ parallel (~> 1.10)
58
+ parser (>= 3.2.2.3)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ regexp_parser (>= 1.8, < 3.0)
61
+ rexml (>= 3.2.5, < 4.0)
62
+ rubocop-ast (>= 1.28.0, < 2.0)
63
+ ruby-progressbar (~> 1.7)
64
+ unicode-display_width (>= 2.4.0, < 3.0)
65
+ rubocop-ast (1.29.0)
66
+ parser (>= 3.2.1.0)
67
+ rubocop-capybara (2.18.0)
68
+ rubocop (~> 1.41)
69
+ rubocop-factory_bot (2.23.1)
70
+ rubocop (~> 1.33)
71
+ rubocop-rspec (2.22.0)
72
+ rubocop (~> 1.33)
73
+ rubocop-capybara (~> 2.17)
74
+ rubocop-factory_bot (~> 2.22)
75
+ ruby-progressbar (1.13.0)
76
+ ruby2_keywords (0.0.5)
77
+ snaky_hash (2.0.1)
78
+ hashie
79
+ version_gem (~> 1.1, >= 1.1.1)
80
+ unicode-display_width (2.4.2)
81
+ version_gem (1.1.3)
82
+
83
+ PLATFORMS
84
+ x86_64-linux
85
+
86
+ DEPENDENCIES
87
+ omniauth (~> 2.1.1)
88
+ omniauth-oauth2 (~> 1.8.0)
89
+ rake (~> 13.0.6)
90
+ rspec (~> 3.12.0)
91
+ rspec_junit_formatter (~> 0.6.0)
92
+ rubocop (~> 1.52.1)
93
+ rubocop-rspec (~> 2.22.0)
94
+
95
+ BUNDLED WITH
96
+ 2.4.10
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Jordan Ell
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,89 @@
1
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/riipen/omniauth-tipalti/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/riipen/omniauth-tipalti/tree/main)
2
+
3
+ # OmniAuth Tipalti
4
+ Strategy to authenticate with Tipalti via OAuth2 in OmniAuth.
5
+
6
+ ## Installation
7
+
8
+ Add to your `Gemfile`:
9
+
10
+ ```ruby
11
+ gem 'omniauth-tipalti'
12
+ ```
13
+
14
+ Then `bundle install`.
15
+
16
+ ## Tipalti Setup
17
+
18
+ Visit the [Tipalti Developer](https://developer.tipalti.com) portal and create your developer application.
19
+
20
+ Make note of your Client ID and Client Secret.
21
+
22
+ Make sure you set your Return URL to the full path to your application.
23
+
24
+ ## Usage
25
+ For additional information, refer to the [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
26
+
27
+ ### Rails
28
+
29
+ #### Standard
30
+
31
+ Here's an example for adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
32
+
33
+ ```ruby
34
+ Rails.application.config.middleware.use OmniAuth::Builder do
35
+ provider :tipalti,
36
+ ENV['TIPALTI_CLIENT_ID'],
37
+ ENV['TIPALTI_CLIENT_SECRET'],
38
+ redirect_uri: Rails.application.routes.url_helpers.my_integration_response_url
39
+ end
40
+ ```
41
+
42
+ You can now access the OmniAuth Tipalti OAuth2 URL: `/auth/tipalti`
43
+
44
+ If you are using a Tipalti sandbox applicaiton, you can optionally set the site:
45
+
46
+ ```ruby
47
+ Rails.application.config.middleware.use OmniAuth::Builder do
48
+ provider :tipalti,
49
+ ...
50
+ client_options: {
51
+ site: ' https://sso.sandbox.tipalti.com',
52
+ },
53
+ ...
54
+ end
55
+ ```
56
+
57
+ #### Dynamic
58
+
59
+ If your Rails application needs to support multiple Tipalti applications, you can pass in your configuration dynamically:
60
+
61
+ ```ruby
62
+ Rails.application.config.middleware.use OmniAuth::Builder do
63
+ TIPALTI_SETUP_PROC = lambda do |env|
64
+ request = Rack::Request.new(env)
65
+
66
+ # Load dynamic content into dynamic_content
67
+
68
+ env['omniauth.strategy'].options[:client_id] = dynamic_content.client_id
69
+ env['omniauth.strategy'].options[:client_secret] = dynamic_content.client_secret
70
+ end
71
+
72
+ provider :tipalti,
73
+ redirect_uri: Rails.application.routes.url_helpers.my_integration_response_url
74
+ setup: TIPALTI_SETUP_PROC
75
+ end
76
+ ```
77
+
78
+ ## Configuration
79
+
80
+ You can configure several options, which you pass in to the `provider` method via a hash:
81
+
82
+ * `scope`: A space-separated list of permissions you want to request from the user.
83
+
84
+ * `redirect_uri`: Override the redirect_uri used by the gem. Note this must match exactly what you specified in the WhoPlusYou Developer Portal in your Client Domains setting.
85
+
86
+
87
+ ## License
88
+
89
+ Copyright (C) 2023 Jordan Ell. See [LICENSE](https://github.com/riipen/omniauth-tipalti/blob/master/LICENSE.md) for details.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth-oauth2"
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class Tipalti < OmniAuth::Strategies::OAuth2
8
+ option :name, "tipalti"
9
+
10
+ option :client_options,
11
+ site: "https://sso.tipalti.com",
12
+ authorize_url: "/connect/authorize/callback",
13
+ token_url: "/connect/token"
14
+
15
+ option :pkce, true
16
+
17
+ uid { nil }
18
+
19
+ info do
20
+ {}
21
+ end
22
+
23
+ extra do
24
+ { "raw_info" => raw_info }
25
+ end
26
+
27
+ def callback_url
28
+ options[:redirect_uri] || (full_host + callback_path)
29
+ end
30
+
31
+ def raw_info
32
+ @raw_info ||= {}
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ OmniAuth.config.add_camelization "tipalti", "Tipalti"
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Omniauth
4
+ module Tipalti
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/strategies/tipalti"
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/tipalti"
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-tipalti
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jordan Ell
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ description: "OmniAuth Oauth2 strategy for Tipalti allowing you to \nconnect to a
42
+ specific Tipalti instance.\n"
43
+ email:
44
+ - me@jordanell.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".rspec"
50
+ - ".rubocop.yml"
51
+ - CHANGELOG.md
52
+ - CODE_OF_CONDUCT.md
53
+ - Gemfile
54
+ - Gemfile.lock
55
+ - LICENSE
56
+ - README.md
57
+ - Rakefile
58
+ - lib/omniauth-tipalti.rb
59
+ - lib/omniauth/strategies/tipalti.rb
60
+ - lib/omniauth/tipalti.rb
61
+ - lib/omniauth/tipalti/version.rb
62
+ homepage: https://github.com/riipen/omniauth-tipalti
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ homepage_uri: https://github.com/riipen/omniauth-tipalti
67
+ source_code_uri: https://github.com/riipen/omniauth-tipalti
68
+ changelog_uri: https://github.com/riipen/omniauth-tipalti/blob/master/CHANGELOG.md
69
+ rubygems_mfa_required: 'true'
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 2.6.0
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubygems_version: 3.3.26
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: OmniAuth Oauth2 strategy for Tipalti.
89
+ test_files: []