omniauth-unbounce 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +7 -0
- data/LICENSE +7 -0
- data/README.md +19 -0
- data/Rakefile +7 -0
- data/lib/omniauth-unbounce.rb +1 -0
- data/lib/omniauth/strategies/unbounce.rb +24 -0
- data/lib/omniauth/unbounce.rb +1 -0
- data/lib/omniauth/unbounce/version.rb +5 -0
- data/omniauth-unbounce.gemspec +24 -0
- data/spec/omniauth/strategies/unbounce_spec.rb +33 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/shared_examples.rb +37 -0
- metadata +131 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2011 Florian Mhun
|
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,19 @@
|
|
1
|
+
#Unbounce Strategie
|
2
|
+
|
3
|
+
Unbounce OAuth2 strategy for OmniAuth 1.0
|
4
|
+
|
5
|
+
## Basic Usage
|
6
|
+
|
7
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
8
|
+
provider :unbounce, ENV['CLIENT_ID'], ENV['CLIENT_SECRET']
|
9
|
+
end
|
10
|
+
|
11
|
+
#License
|
12
|
+
|
13
|
+
Copyright (c) 2013 Lucas Allan Amorim (www.lucasallan.com)
|
14
|
+
|
15
|
+
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:
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
18
|
+
|
19
|
+
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/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/unbounce'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Unbounce < OmniAuth::Strategies::OAuth2
|
7
|
+
|
8
|
+
option :name, 'unbounce'
|
9
|
+
|
10
|
+
option :client_options, {
|
11
|
+
site: 'http://api.unbounce.com/',
|
12
|
+
authorize_url: '/oauth/authorize',
|
13
|
+
token_url: '/oauth/token'
|
14
|
+
}
|
15
|
+
|
16
|
+
def request_phase
|
17
|
+
req = Rack::Request.new(@env)
|
18
|
+
options.update(req.params)
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/strategies/unbounce'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth/unbounce/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
6
|
+
|
7
|
+
gem.authors = ['Lucas Allan']
|
8
|
+
gem.email = ['lucas.allan@gmail.com']
|
9
|
+
gem.description = %q{Unbounce strategy for OmniAuth 1.0}
|
10
|
+
gem.summary = %q{Unbounce strategy for OmniAuth 1.0.}
|
11
|
+
gem.homepage = 'http://github.com/lucasallan/omniauth-unbounce'
|
12
|
+
|
13
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
gem.name = 'omniauth-unbounce'
|
17
|
+
gem.require_paths = ['lib']
|
18
|
+
gem.version = OmniAuth::Unbounce::VERSION
|
19
|
+
|
20
|
+
gem.add_runtime_dependency 'omniauth-oauth2'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rspec'
|
23
|
+
gem.add_development_dependency 'rake'
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth-unbounce'
|
3
|
+
|
4
|
+
describe OmniAuth::Strategies::Unbounce do
|
5
|
+
before :each do
|
6
|
+
@request = double('Request')
|
7
|
+
@request.stub(:params) { {} }
|
8
|
+
end
|
9
|
+
|
10
|
+
subject do
|
11
|
+
OmniAuth::Strategies::Unbounce.new(nil, @options || {}).tap do |strategy|
|
12
|
+
strategy.stub(:request) { @request }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it_should_behave_like 'an oauth2 strategy'
|
17
|
+
|
18
|
+
describe '#client' do
|
19
|
+
it 'has correct unbounce api site' do
|
20
|
+
subject.options.client_options.site.should eq('http://api.unbounce.com/')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'has correct authorize url' do
|
24
|
+
subject.options.client_options.authorize_url.should eq('/oauth/authorize')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#callback_path' do
|
29
|
+
it 'should have the correct callback path' do
|
30
|
+
subject.callback_path.should eq('/auth/unbounce/callback')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
+
shared_examples 'an oauth2 strategy' do
|
3
|
+
describe '#client' do
|
4
|
+
it 'initializes with symbolized client_options' do
|
5
|
+
@options = { client_options: { 'authorize_url' => 'https://example.com' } }
|
6
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#authorize_params' do
|
11
|
+
xit 'includes any authorize params passed in the :authorize_params option' do
|
12
|
+
@options = { authorize_params: { foo: 'bar', baz: 'zip' } }
|
13
|
+
subject.authorize_params['foo'].should eq('bar')
|
14
|
+
subject.authorize_params['baz'].should eq('zip')
|
15
|
+
end
|
16
|
+
|
17
|
+
xit 'includes top-level options that are marked as :authorize_options' do
|
18
|
+
@options = { authorize_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
|
19
|
+
subject.authorize_params['scope'].should eq('bar')
|
20
|
+
subject.authorize_params['foo'].should eq('baz')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#token_params' do
|
25
|
+
it 'includes any token params passed in the :token_params option' do
|
26
|
+
@options = { token_params: { foo: 'bar', baz: 'zip' } }
|
27
|
+
subject.token_params['foo'].should eq('bar')
|
28
|
+
subject.token_params['baz'].should eq('zip')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'includes top-level options that are marked as :token_options' do
|
32
|
+
@options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
|
33
|
+
subject.token_params['scope'].should eq('bar')
|
34
|
+
subject.token_params['foo'].should eq('baz')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-unbounce
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Lucas Allan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: omniauth-oauth2
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Unbounce strategy for OmniAuth 1.0
|
79
|
+
email:
|
80
|
+
- lucas.allan@gmail.com
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- .gitignore
|
86
|
+
- Gemfile
|
87
|
+
- LICENSE
|
88
|
+
- README.md
|
89
|
+
- Rakefile
|
90
|
+
- lib/omniauth-unbounce.rb
|
91
|
+
- lib/omniauth/strategies/unbounce.rb
|
92
|
+
- lib/omniauth/unbounce.rb
|
93
|
+
- lib/omniauth/unbounce/version.rb
|
94
|
+
- omniauth-unbounce.gemspec
|
95
|
+
- spec/omniauth/strategies/unbounce_spec.rb
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
- spec/support/shared_examples.rb
|
98
|
+
homepage: http://github.com/lucasallan/omniauth-unbounce
|
99
|
+
licenses: []
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
hash: 1621937555468616337
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
hash: 1621937555468616337
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 1.8.25
|
125
|
+
signing_key:
|
126
|
+
specification_version: 3
|
127
|
+
summary: Unbounce strategy for OmniAuth 1.0.
|
128
|
+
test_files:
|
129
|
+
- spec/omniauth/strategies/unbounce_spec.rb
|
130
|
+
- spec/spec_helper.rb
|
131
|
+
- spec/support/shared_examples.rb
|