omniauth-attio 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 89c138119deab89c6fa77e9b38d61ce4b1f34fcb3c87c2415d62e1ff82e359c1
4
+ data.tar.gz: 49c125f76e67ed2b141903f61e4e1aa718ebcc77992d01679e5ee47a1cfd9b46
5
+ SHA512:
6
+ metadata.gz: f860f8d8ac72df51703e19e75bb7ea76ffad6081cbb0599901016229690e0c8825ee0da0dfaf4586ad2ea84bed19b802c2b0b9bf33ec6e2d2294e0791cadd98e
7
+ data.tar.gz: aaad54b84c188d75f2ad39a6b442bccf5b3070cce193c93a61696c3ffa719e57434d3756582d55f5b493a994a0395aa39bdd9ba8d71318f011180eb0bc92f04e
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in omniauth-attio.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-attio (0.1.1)
5
+ omniauth-oauth2 (~> 1.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.5.0)
11
+ faraday (2.7.10)
12
+ faraday-net_http (>= 2.0, < 3.1)
13
+ ruby2_keywords (>= 0.0.4)
14
+ faraday-net_http (3.0.2)
15
+ hashie (5.0.0)
16
+ jwt (2.7.1)
17
+ multi_xml (0.6.0)
18
+ oauth2 (2.0.9)
19
+ faraday (>= 0.17.3, < 3.0)
20
+ jwt (>= 1.0, < 3.0)
21
+ multi_xml (~> 0.5)
22
+ rack (>= 1.2, < 4)
23
+ snaky_hash (~> 2.0)
24
+ version_gem (~> 1.1)
25
+ omniauth (2.1.1)
26
+ hashie (>= 3.4.6)
27
+ rack (>= 2.2.3)
28
+ rack-protection
29
+ omniauth-oauth2 (1.8.0)
30
+ oauth2 (>= 1.4, < 3)
31
+ omniauth (~> 2.0)
32
+ rack (3.0.8)
33
+ rack-protection (3.0.6)
34
+ rack
35
+ rake (12.3.3)
36
+ rspec (3.12.0)
37
+ rspec-core (~> 3.12.0)
38
+ rspec-expectations (~> 3.12.0)
39
+ rspec-mocks (~> 3.12.0)
40
+ rspec-core (3.12.2)
41
+ rspec-support (~> 3.12.0)
42
+ rspec-expectations (3.12.3)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.12.0)
45
+ rspec-mocks (3.12.6)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.12.0)
48
+ rspec-support (3.12.1)
49
+ ruby2_keywords (0.0.5)
50
+ snaky_hash (2.0.1)
51
+ hashie
52
+ version_gem (~> 1.1, >= 1.1.1)
53
+ version_gem (1.1.3)
54
+
55
+ PLATFORMS
56
+ arm64-darwin-21
57
+
58
+ DEPENDENCIES
59
+ bundler (~> 2.2.33)
60
+ omniauth-attio!
61
+ rake (~> 12.3.3)
62
+ rspec (~> 3.0)
63
+
64
+ BUNDLED WITH
65
+ 2.2.33
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Ferruccio Balestreri
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,84 @@
1
+ # Omniauth::Attio
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/omniauth-attio.svg)](https://badge.fury.io/rb/omniauth-attio)
4
+
5
+ This gem contains the Attio strategy for OmniAuth.
6
+
7
+ For more information about the Attio Api authentication: https://attio.com/developers/authentication
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'omniauth-attio'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install omniauth-attio
24
+
25
+ ## Usage
26
+
27
+ If you are using rails, you need to add the gem to your Gemfile:
28
+
29
+ ```ruby
30
+ gem 'omniauth-attio'
31
+ ```
32
+
33
+ You can pull them in directly from github e.g.:
34
+
35
+ ```ruby
36
+ gem "omniauth-attio", :git => "git://github.com/juneHQ/omniauth-attio.git"
37
+ ```
38
+
39
+ Add provider in omniauth.rb along with CLIENT_ID and CLIENT_SECRET
40
+
41
+ e.g.
42
+
43
+ ```ruby
44
+ provider :attio, ATTIO_CLIENT_ID, ATTIO_CLIENT_SECRET, , {
45
+ callback_url: ATTIO_CALLBACK_URL,
46
+ scope: ATTIO_SCOPE
47
+ }
48
+ ```
49
+
50
+ Obtain your CLIENT_ID/CLIENT_SECRET by registering your app inside the Attio app in the "Developers" section.
51
+
52
+ After you have the gem running and the configuration is done, you can go to this url to log the user in:
53
+
54
+ http://localhost:3000/auth/attio
55
+
56
+ ### Where are the token and the source names?
57
+
58
+ From your callback controller you can find your token: `request.env['omniauth.auth'].credentials.token` and the source names: `request.env['omniauth.auth'].info.source_names` along with the rest information that Attio returns.
59
+
60
+ Now just follow the README at: https://github.com/omniauth/omniauth
61
+
62
+ ### Error handling
63
+
64
+ - If the user does not have access to the repository, the script will fail with a 404 error
65
+
66
+ - If the repository does not exist, the script will fail with a 404 error
67
+
68
+ - If the user does not have any public repository, the script will fail with a 404 error
69
+
70
+ - If the user does not exist, the script will fail with a 404 error
71
+
72
+ - If the user does not provide a username, the script will fail with a 404 error
73
+
74
+ - If the user does not provide a repository, the script will fail with a 404 error
75
+
76
+ - If the user does not provide a token, the script will fail with a 404 error
77
+
78
+ ## Contributing
79
+
80
+ Bug reports and pull requests are welcome on GitHub at https://github.com/juneHQ/omniauth-attio.
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,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth/attio"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,38 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ # Attio Omniauth Strategy
6
+ class Attio < OmniAuth::Strategies::OAuth2
7
+ option :name, 'attio'
8
+
9
+ option :client_options, \
10
+ site: 'https://app.attio.com',
11
+ response_type: 'code',
12
+ authorize_url: 'https://app.attio.com/authorize',
13
+ token_url: 'https://app.attio.com/oauth/token'
14
+
15
+ info do
16
+ access_token.params.to_h
17
+ end
18
+
19
+ def scope
20
+ options[:scope]
21
+ end
22
+
23
+ def build_access_token
24
+ options.token_params.merge!(:headers => {'Authorization' => basic_auth_header })
25
+ super
26
+ end
27
+
28
+ def basic_auth_header
29
+ "Basic " + Base64.strict_encode64("#{options[:client_id]}:#{options[:client_secret]}")
30
+ end
31
+
32
+ def callback_url
33
+ return options[:redirect_uri] unless options[:redirect_uri].nil?
34
+ full_host + script_name + callback_path
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Attio
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth/strategies/omniauth-attio"
2
+ require "omniauth-attio/version"
@@ -0,0 +1,28 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "omniauth-attio/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-attio"
8
+ spec.version = OmniAuth::Attio::VERSION
9
+ spec.authors = ["Ferruccio Balestreri"]
10
+ spec.email = ["ferruccio@june.so"]
11
+
12
+ spec.summary = %q{OmniAuth strategy for Attio}
13
+ spec.description = %q{OmniAuth strategy for Attio}
14
+ spec.homepage = "https://github.com/juneHQ/omniauth-attio"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6'
25
+ spec.add_development_dependency "bundler", "~> 2.2.33"
26
+ spec.add_development_dependency "rake", "~> 12.3.3"
27
+ spec.add_development_dependency "rspec", "~> 3.0"
28
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-attio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Ferruccio Balestreri
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-08-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.33
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.2.33
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 12.3.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 12.3.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: OmniAuth strategy for Attio
70
+ email:
71
+ - ferruccio@june.so
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - Gemfile
77
+ - Gemfile.lock
78
+ - LICENSE
79
+ - README.md
80
+ - Rakefile
81
+ - bin/console
82
+ - bin/setup
83
+ - lib/omniauth-attio.rb
84
+ - lib/omniauth-attio/version.rb
85
+ - lib/omniauth/strategies/omniauth-attio.rb
86
+ - omniauth-attio.gemspec
87
+ homepage: https://github.com/juneHQ/omniauth-attio
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.2.33
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: OmniAuth strategy for Attio
110
+ test_files: []