omniauth-leaddyno 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e3f30289d19176b1ac85b5338eac688fb4f7b30b
4
+ data.tar.gz: dbade1181ce54298620d3c1b2404ee2201973f76
5
+ SHA512:
6
+ metadata.gz: ce5ca3b202bb093edc54508bd9e01f4b50c4d8a74b816db3eac9b9c7adc5c07f681a98a0ebe6e2a1362411821f342c5578bb7c67cfc333e166f3447811e45c41
7
+ data.tar.gz: 92198813a21a3a4eaa6e500720992a5e721727209c6c797da9669772835b8b9c7ec3c1d2975ccca9c01aecd57fc1fee386fc51059cf2915b8269cb6bb0228d02
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,50 @@
1
+
2
+ # OmniAuth LeadDyno
3
+
4
+ LeadDyno OAuth2 Strategy for OmniAuth 1.0.
5
+
6
+ ## Installing
7
+
8
+ Add to your `Gemfile`:
9
+
10
+ ```ruby
11
+ gem 'omniauth-leaddyno'
12
+ ```
13
+
14
+ Then `bundle install`.
15
+
16
+ ## Usage
17
+
18
+ `OmniAuth::Strategies::LeadDyno` is simply a Rack middleware. Read [the OmniAuth 1.0 docs](https://github.com/intridea/omniauth) for detailed instructions.
19
+
20
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
21
+
22
+ ```ruby
23
+ Rails.application.config.middleware.use OmniAuth::Builder do
24
+ provider :leaddyno, ENV['LEADDYNO_API_KEY'], ENV['LEADDYNO_SHARED_SECRET']
25
+ end
26
+ ```
27
+
28
+ ## Authentication Hash
29
+
30
+ Here's an example *Authentication Hash* available in `request.env['omniauth.auth']`:
31
+
32
+ ```ruby
33
+ {
34
+ :provider => 'leaddyno',
35
+ :uid => '1234',
36
+ :credentials => {
37
+ :token => 'afasd923kjh0934kf', # OAuth 2.0 access_token, which you store and use to authenticate API requests
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## License
43
+
44
+ Copyright (c) 2016 by LeadDyno, LLC
45
+
46
+ 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:
47
+
48
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
49
+
50
+ 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.
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :spec
@@ -0,0 +1 @@
1
+ require 'omniauth/leaddyno'
@@ -0,0 +1,2 @@
1
+ require 'omniauth/leaddyno/version'
2
+ require 'omniauth/strategies/leaddyno'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Leaddyno
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Leaddyno < OmniAuth::Strategies::OAuth2
6
+
7
+ option :client_options, {
8
+ :site => 'https://app.leaddyno.com',
9
+ :authorize_url => '/oauth/authorize',
10
+ :token_url => '/oauth/access_token'
11
+ }
12
+
13
+ uid{ raw_info['id'] }
14
+
15
+ info do
16
+ {
17
+ :email => raw_info['email'],
18
+ }
19
+ end
20
+
21
+ extra do
22
+ {
23
+ 'raw_info' => raw_info
24
+ }
25
+ end
26
+
27
+ def raw_info
28
+ @raw_info ||= access_token.get('/v1/account/info').parsed
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/leaddyno/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-leaddyno"
8
+ spec.version = OmniAuth::Leaddyno::VERSION
9
+ spec.authors = ["Mike Machado"]
10
+ spec.email = ["mike@leaddyno.com"]
11
+
12
+ spec.summary = %q{LeadDyno strategy for OmniAuth.}
13
+ spec.homepage = "https://github.com/LeadDyno/omniauth-leaddyno"
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "minitest", "~> 5.0"
25
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-leaddyno
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mike Machado
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-14 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.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description:
70
+ email:
71
+ - mike@leaddyno.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - README.md
80
+ - Rakefile
81
+ - lib/omniauth-leaddyno.rb
82
+ - lib/omniauth/leaddyno.rb
83
+ - lib/omniauth/leaddyno/version.rb
84
+ - lib/omniauth/strategies/leaddyno.rb
85
+ - omniauth-leaddyno.gemspec
86
+ homepage: https://github.com/LeadDyno/omniauth-leaddyno
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.4.8
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: LeadDyno strategy for OmniAuth.
110
+ test_files: []