omniauth-heap 0.1.2

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: 555bf332f8e204e27a2534cd5f1eff604a00a8a836a633fd85503d9b6fd116ee
4
+ data.tar.gz: 492e30d8ae6119b76d94ea2fd81c8ca05677bf43ed83e2e861a7d76e91472084
5
+ SHA512:
6
+ metadata.gz: 6384e8e59fce88a5da7bb21ea3806ee2d63eba2bec41db5432459800f576826c4a53d838c93369477157e37162a6b0c26601526fcc3310a00edba32653060090
7
+ data.tar.gz: 46785f37081a0a38af66ab933b1bbdb0ccc91f68df5c28a67fc2cfc67fbe25f597dbf6efd0acb4254846cb97d2a6ae3fe2e95230b1079a6e373a58882e1f42c6
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .idea
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2021 Chameleon (Brian Norton)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # OmniAuth Heap
2
+
3
+ Heap OAuth2 Strategy for OmniAuth.
4
+
5
+ Read the [Heap OAuth docs](https://github.com/heap/heap-partner-api-reference) for more details:
6
+
7
+ ## Installing
8
+
9
+ Add to your `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'omniauth-heap'
13
+ ```
14
+
15
+ Then `bundle install`.
16
+
17
+ ## Usage
18
+
19
+ `OmniAuth::Strategies::Heap` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
20
+
21
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
22
+
23
+ ```ruby
24
+ Rails.application.config.middleware.use OmniAuth::Builder do
25
+ provider :heap, ENV['OAUTH_HEAP_KEY'], ENV['OAUTH_HEAP_SECRET'], scope: 'segment'
26
+ end
27
+ ```
28
+
29
+ `segment` is the only currently supported Scope
30
+
31
+ To start the authentication process with Heap you simply need to access `/auth/heap` route.
32
+
33
+ ## Callback URL
34
+
35
+ You define a callback URL in Heap that is matched 1-1 (no query string parameters allowed).
36
+ To make sure the value entered into Heap matches exactly, define the callback URL as and environment variable.
37
+
38
+ ```
39
+ OAUTH_HEAP_CALLBACK_URL="https://auth.example.com/auth/heap/callback"
40
+ ```
41
+
42
+ ## Auth Hash
43
+
44
+ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
45
+
46
+ ```ruby
47
+ {
48
+ :provider => 'heap',
49
+ :uid => nil,
50
+ :info => {
51
+ :name => nil
52
+ },
53
+ :credentials => {
54
+ :token => 'ehJy6IkiOiJFUzUxGcGnR5cMiXVCJ9.eyJqdGk47eiOiIc209c5eiJod431ce3272dd213a9...',
55
+ :expires => false
56
+ },
57
+ :extra => { }
58
+ }
59
+ ```
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ desc "Build the gem"
4
+ task :build do
5
+ system "gem build omniauth-heap.gemspec"
6
+ end
7
+
8
+ desc "Build and release the gem"
9
+ task :release => :build do
10
+ system "gem push omniauth-heap-#{OmniAuth::Heap::VERSION}.gem"
11
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Heap
3
+ VERSION = '0.1.2'
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'omniauth/heap/version'
2
+ require 'omniauth/strategies/heap'
@@ -0,0 +1,25 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Heap < OmniAuth::Strategies::OAuth2
6
+ option :name, 'heap'
7
+
8
+ args [:client_id, :client_secret]
9
+
10
+ option :client_options, {
11
+ site: 'https://heapanalytics.com',
12
+ authorize_url: 'https://heapanalytics.com/api/partner/oauth/authorize',
13
+ token_url: 'https://heapanalytics.com/api/partner/oauth/token'
14
+ }
15
+
16
+ option :auth_token_params, {
17
+ grant_type: 'authorization_code'
18
+ }
19
+
20
+ def callback_url
21
+ ENV['OAUTH_HEAP_CALLBACK_URL'] || (full_host + script_name + callback_path)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1 @@
1
+ require 'omniauth/heap'
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth/heap/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.add_dependency 'omniauth'
6
+ gem.add_dependency 'oauth2'
7
+ gem.add_dependency 'omniauth-oauth2'
8
+
9
+ gem.authors = ['Brian Norton']
10
+ gem.email = ['brian@trychameleon.com']
11
+ gem.description = %q{An OmniAuth strategy for authenticating with the Heap API.}
12
+ gem.summary = %q{OmniAuth strategy for authenticating with Heap.}
13
+ gem.homepage = 'https://github.com/chamaeleonidae/omniauth-heap'
14
+ gem.license = 'MIT'
15
+
16
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ gem.files = `git ls-files`.split("\n")
18
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ gem.name = 'omniauth-heap'
20
+ gem.require_paths = ['lib']
21
+ gem.version = OmniAuth::Heap::VERSION
22
+ end
23
+
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-heap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Brian Norton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-21 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
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: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: An OmniAuth strategy for authenticating with the Heap API.
56
+ email:
57
+ - brian@trychameleon.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - lib/omniauth-heap.rb
68
+ - lib/omniauth/heap.rb
69
+ - lib/omniauth/heap/version.rb
70
+ - lib/omniauth/strategies/heap.rb
71
+ - omniauth-heap.gemspec
72
+ homepage: https://github.com/chamaeleonidae/omniauth-heap
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 3.1.4
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: OmniAuth strategy for authenticating with Heap.
95
+ test_files: []