omniauth-gong 1.0.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: ed1c0269bb97b31f7c699e195e46bb5ba470be7830901953523e9c6c3cc493e9
4
+ data.tar.gz: bff5d9ff8c2c85234c7edb3c6f6dc5cd25113eeca6f3f3d9b1313f54f7e58613
5
+ SHA512:
6
+ metadata.gz: 4ccd484f7713a73df8f407dbe3959a21e28b3908a601e84349e3fc4bfc9060c006c74dcd586b18030888d9357a5b816e889124d68e792cb848dc5a8dba36d895
7
+ data.tar.gz: 8087fb9bc669fab8902b1984f061984845d91ff44026afefe1f6081c4eb04a507c10813c802ba9debe7f6f4c5465444e1e2408564343ffa856ef884211751344
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ rubocop:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ bundler-cache: true
18
+ - name: Install dependencies
19
+ run: bundle install
20
+ - name: Run rubocop
21
+ run: bundle exec rubocop
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.2
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.1.2
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-gong (1.0.0)
5
+ omniauth (~> 2.0)
6
+ omniauth-oauth2 (~> 1.7)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ faraday (2.7.4)
13
+ faraday-net_http (>= 2.0, < 3.1)
14
+ ruby2_keywords (>= 0.0.4)
15
+ faraday-net_http (3.0.2)
16
+ hashie (5.0.0)
17
+ json (2.6.3)
18
+ jwt (2.6.0)
19
+ multi_xml (0.6.0)
20
+ oauth2 (2.0.9)
21
+ faraday (>= 0.17.3, < 3.0)
22
+ jwt (>= 1.0, < 3.0)
23
+ multi_xml (~> 0.5)
24
+ rack (>= 1.2, < 4)
25
+ snaky_hash (~> 2.0)
26
+ version_gem (~> 1.1)
27
+ omniauth (2.1.1)
28
+ hashie (>= 3.4.6)
29
+ rack (>= 2.2.3)
30
+ rack-protection
31
+ omniauth-oauth2 (1.8.0)
32
+ oauth2 (>= 1.4, < 3)
33
+ omniauth (~> 2.0)
34
+ parallel (1.22.1)
35
+ parser (3.2.0.0)
36
+ ast (~> 2.4.1)
37
+ rack (3.0.4.1)
38
+ rack-protection (3.0.5)
39
+ rack
40
+ rainbow (3.1.1)
41
+ regexp_parser (2.6.2)
42
+ rexml (3.2.5)
43
+ rubocop (1.43.0)
44
+ json (~> 2.3)
45
+ parallel (~> 1.10)
46
+ parser (>= 3.2.0.0)
47
+ rainbow (>= 2.2.2, < 4.0)
48
+ regexp_parser (>= 1.8, < 3.0)
49
+ rexml (>= 3.2.5, < 4.0)
50
+ rubocop-ast (>= 1.24.1, < 2.0)
51
+ ruby-progressbar (~> 1.7)
52
+ unicode-display_width (>= 2.4.0, < 3.0)
53
+ rubocop-ast (1.24.1)
54
+ parser (>= 3.1.1.0)
55
+ ruby-progressbar (1.11.0)
56
+ ruby2_keywords (0.0.5)
57
+ snaky_hash (2.0.1)
58
+ hashie
59
+ version_gem (~> 1.1, >= 1.1.1)
60
+ unicode-display_width (2.4.2)
61
+ version_gem (1.1.1)
62
+
63
+ PLATFORMS
64
+ arm64-darwin-21
65
+
66
+ DEPENDENCIES
67
+ omniauth-gong!
68
+ rubocop (~> 1.42)
69
+
70
+ BUNDLED WITH
71
+ 2.3.22
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Matija Čupić
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,62 @@
1
+ [![Gem Version](https://badge.fury.io/rb/omniauth-gong.svg)](https://badge.fury.io/rb/omniauth-gong)
2
+
3
+ # OmniAuth Gong Strategy
4
+
5
+ Strategy to authenticate with Gong via OAuth2 in OmniAuth.
6
+
7
+ You can get your OAuth app client id and secret from - <https://us-55616.app.gong.io/company/api-authentication>
8
+
9
+ Gong OAuth app docs - <https://help.gong.io/hc/en-us/articles/360056677792-Create-an-app-for-Gong>
10
+
11
+ ## Installation
12
+
13
+ Add to your `Gemfile`:
14
+
15
+ ```ruby
16
+ gem 'omniauth-gong'
17
+ ```
18
+
19
+ Then `bundle install`.
20
+
21
+ ## Gong API Setup
22
+
23
+ * Go to [`https://us-55616.app.gong.io/company/api-authentication`](https://us-55616.app.gong.io/company/api-authentication)
24
+ * Follow the instructions in <https://help.gong.io/hc/en-us/articles/360056677792-Create-an-app-for-Gong>
25
+
26
+ ## Usage
27
+
28
+ Here's an example for adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
29
+
30
+ ```ruby
31
+ Rails.application.config.middleware.use OmniAuth::Builder do
32
+ provider :gong,
33
+ Rails.application.credentials.dig(:gong, :client_id),
34
+ Rails.application.credentials.dig(:gong, :client_secret),
35
+ scope: 'api:calls:read:basic'
36
+ end
37
+ ```
38
+
39
+ You can now access the OmniAuth Gong URL: `/auth/gong`
40
+
41
+ NOTE: While developing your application, if you change the scope in the initializer you will need to restart your app server.
42
+
43
+ ## Configuration
44
+
45
+ You can configure several options, which you pass in to the `provider` method via a hash:
46
+
47
+ * `scope`: A space-separated list of permissions you want to request from the user.
48
+
49
+ Here's an example of a possible configuration
50
+
51
+ ```ruby
52
+ Rails.application.config.middleware.use OmniAuth::Builder do
53
+ provider :gong,
54
+ Rails.application.credentials.dig(:gong, :client_id),
55
+ Rails.application.credentials.dig(:gong, :client_secret),
56
+ scope: 'api:calls:read:extensive api:calls:read:media-url'
57
+ end
58
+ ```
59
+
60
+ ## License
61
+
62
+ See [LICENSE](LICENSE)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Gong
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/strategies/gong'
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/strategies/oauth2'
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ # Authentication strategy for connecting with APIs constructed using
8
+ # the [OAuth 2.0 Specification](http://tools.ietf.org/html/draft-ietf-oauth-v2-10).
9
+ # You must generally register your application with the provider and
10
+ # utilize an application id and secret in order to authenticate using
11
+ # OAuth 2.0.
12
+ class Gong < OmniAuth::Strategies::OAuth2
13
+ option :name, 'gong'
14
+ option :client_options, { site: 'https://app.gong.io', authorize_url: '/oauth2/authorize', token_url: '/oauth2/generate-token' }
15
+ option :pkce, false
16
+
17
+ private
18
+
19
+ def callback_url
20
+ full_host + callback_path
21
+ end
22
+
23
+ def token_params
24
+ auth_header = "Basic #{Base64.strict_encode64("#{options.client_id}:#{options.client_secret}")}"
25
+ super.merge(headers: { Authorization: auth_header })
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/gong'
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path(
4
+ File.join('..', 'lib', 'omniauth', 'gong', 'version'),
5
+ __FILE__
6
+ )
7
+
8
+ Gem::Specification.new do |gem|
9
+ gem.name = 'omniauth-gong'
10
+ gem.version = OmniAuth::Gong::VERSION
11
+ gem.license = 'MIT'
12
+ gem.summary = %(A Gong OAuth2 strategy for OmniAuth 1.x)
13
+ gem.description = %(A Gong OAuth2 strategy for OmniAuth 1.x. This allows you to login to Gong with your ruby app.)
14
+ gem.authors = ['Matija Čupić']
15
+ gem.email = ['matteeyah@gmail.com']
16
+ gem.homepage = 'https://github.com/matteeyah/omniauth-gong'
17
+
18
+ gem.metadata['rubygems_mfa_required'] = 'true'
19
+
20
+ gem.files = `git ls-files`.split("\n")
21
+ gem.require_paths = ['lib']
22
+
23
+ gem.required_ruby_version = '>= 2.2'
24
+
25
+ gem.add_runtime_dependency 'omniauth', '~> 2.0'
26
+ gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.7'
27
+
28
+ gem.add_development_dependency 'rubocop', '~> 1.42'
29
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-gong
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matija Čupić
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-22 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.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.42'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.42'
55
+ description: A Gong OAuth2 strategy for OmniAuth 1.x. This allows you to login to
56
+ Gong with your ruby app.
57
+ email:
58
+ - matteeyah@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".github/worflows/main.yml"
64
+ - ".gitignore"
65
+ - ".rubocop.yml"
66
+ - ".tool-versions"
67
+ - Gemfile
68
+ - Gemfile.lock
69
+ - LICENSE
70
+ - README.md
71
+ - lib/omniauth/gong.rb
72
+ - lib/omniauth/gong/version.rb
73
+ - lib/omniauth/strategies/gong.rb
74
+ - lib/omniauth_gong.rb
75
+ - omniauth-gong.gemspec
76
+ homepage: https://github.com/matteeyah/omniauth-gong
77
+ licenses:
78
+ - MIT
79
+ metadata:
80
+ rubygems_mfa_required: 'true'
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '2.2'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.3.7
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: A Gong OAuth2 strategy for OmniAuth 1.x
100
+ test_files: []