omniauth-cv 0.1.0
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 +7 -0
- data/.rspec +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +63 -0
- data/LICENSE.txt +22 -0
- data/README.md +21 -0
- data/Rakefile +8 -0
- data/lib/omniauth-cv.rb +2 -0
- data/lib/omniauth/cv/version.rb +5 -0
- data/lib/omniauth/strategies/cv.rb +21 -0
- data/omniauth-cv.gemspec +28 -0
- data/spec/omniauth/strategies/cv_spec.rb +65 -0
- data/spec/spec_helper.rb +14 -0
- metadata +156 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 51583aac2346db63d8d619a2d728a10555d61530
|
4
|
+
data.tar.gz: 34211c3e59f8d8634b1f3b2a99f0266fba00dbb3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7a49b234c0384b5056ea5becc9628f081a7e3afde393478b2305415da8af7135e53c2b1d229623b1bc6af0c056d25a57030e1c10cbcf79d4fd6d2881e4f5fcf0
|
7
|
+
data.tar.gz: 744689366e3e698ba79fda797623d62a2fb302b44e1bc57fcb77319bce7ca10d2a99d4b8b8d5505428f1c874b891718f932ccdc237ee49d3a9f75a0c1aba861b
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-cv (0.1.0)
|
5
|
+
hashr
|
6
|
+
omniauth-oauth2
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.5)
|
12
|
+
crack (0.4.1)
|
13
|
+
safe_yaml (~> 0.9.0)
|
14
|
+
diff-lcs (1.2.4)
|
15
|
+
faraday (0.9.1)
|
16
|
+
multipart-post (>= 1.2, < 3)
|
17
|
+
hashie (3.4.0)
|
18
|
+
hashr (0.0.22)
|
19
|
+
jwt (1.2.1)
|
20
|
+
multi_json (1.10.1)
|
21
|
+
multi_xml (0.5.5)
|
22
|
+
multipart-post (2.0.0)
|
23
|
+
oauth2 (1.0.0)
|
24
|
+
faraday (>= 0.8, < 0.10)
|
25
|
+
jwt (~> 1.0)
|
26
|
+
multi_json (~> 1.3)
|
27
|
+
multi_xml (~> 0.5)
|
28
|
+
rack (~> 1.2)
|
29
|
+
omniauth (1.2.2)
|
30
|
+
hashie (>= 1.2, < 4)
|
31
|
+
rack (~> 1.0)
|
32
|
+
omniauth-oauth2 (1.2.0)
|
33
|
+
faraday (>= 0.8, < 0.10)
|
34
|
+
multi_json (~> 1.3)
|
35
|
+
oauth2 (~> 1.0)
|
36
|
+
omniauth (~> 1.2)
|
37
|
+
rack (1.5.2)
|
38
|
+
rack-test (0.6.2)
|
39
|
+
rack (>= 1.0)
|
40
|
+
rake (10.1.0)
|
41
|
+
rspec (2.14.1)
|
42
|
+
rspec-core (~> 2.14.0)
|
43
|
+
rspec-expectations (~> 2.14.0)
|
44
|
+
rspec-mocks (~> 2.14.0)
|
45
|
+
rspec-core (2.14.5)
|
46
|
+
rspec-expectations (2.14.2)
|
47
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
48
|
+
rspec-mocks (2.14.3)
|
49
|
+
safe_yaml (0.9.5)
|
50
|
+
webmock (1.13.0)
|
51
|
+
addressable (>= 2.2.7)
|
52
|
+
crack (>= 0.3.2)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
bundler (~> 1.3)
|
59
|
+
omniauth-cv!
|
60
|
+
rack-test
|
61
|
+
rake
|
62
|
+
rspec
|
63
|
+
webmock
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Felix Clack
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Omniauth::CV
|
2
|
+
|
3
|
+
An OmniAuth strategy for connecting to the CV Identity service.
|
4
|
+
|
5
|
+
Add this to `config/initializers/devise.rb`
|
6
|
+
|
7
|
+
Devise.setup do |config|
|
8
|
+
...
|
9
|
+
config.omniauth :cv, APP_ID, APP_SECRET
|
10
|
+
end
|
11
|
+
|
12
|
+
To change the endpoint of the provider, make use of the `setup` option
|
13
|
+
available to `Rack::Builder`.
|
14
|
+
|
15
|
+
Devise.setup do |config|
|
16
|
+
config.omniauth :cv, APP_ID, APP_SECRET,
|
17
|
+
setup: lambda { |env|
|
18
|
+
env['omniauth.strategy'].options[:client_options].site = "http://your-identity.provider.com"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
data/Rakefile
ADDED
data/lib/omniauth-cv.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class CV < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, 'cv'
|
7
|
+
option :client_options, { site: 'https://id.yesheis.com' }
|
8
|
+
|
9
|
+
uid { raw_info['uid'] }
|
10
|
+
|
11
|
+
info do
|
12
|
+
raw_info
|
13
|
+
end
|
14
|
+
|
15
|
+
def raw_info
|
16
|
+
@raw_info ||= access_token.get('/me').parsed
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
data/omniauth-cv.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/cv/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-cv"
|
8
|
+
spec.version = OmniAuth::CV::VERSION
|
9
|
+
spec.authors = ["Felix Clack"]
|
10
|
+
spec.email = ["felixclack@gmail.com"]
|
11
|
+
spec.description = %q{Provide access to the OAuth2 provider powering SSO for all things CV}
|
12
|
+
spec.summary = %q{An OmniAuth strategy for CV}
|
13
|
+
spec.homepage = "https://github.com/cvcnetwork/omniauth-cv"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "omniauth-oauth2"
|
22
|
+
spec.add_dependency "hashr"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rack-test"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "webmock"
|
28
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::CV do
|
4
|
+
def app; lambda{|env| [200, {}, ["Hello."]]} end
|
5
|
+
let(:fresh_strategy){ Class.new(OmniAuth::Strategies::CV) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
OmniAuth.config.test_mode = true
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
OmniAuth.config.test_mode = false
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#client' do
|
16
|
+
subject{ fresh_strategy }
|
17
|
+
|
18
|
+
it 'should be initialized with symbolized client_options' do
|
19
|
+
instance = subject.new(app, :client_options => {'authorize_url' => 'https://example.com'})
|
20
|
+
instance.client.options[:authorize_url].should == 'https://example.com'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should set ssl options as connection options' do
|
24
|
+
instance = subject.new(app, :client_options => {'ssl' => {'ca_path' => 'foo'}})
|
25
|
+
instance.client.options[:connection_opts][:ssl] =~ {:ca_path => 'foo'}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#authorize_params' do
|
30
|
+
subject { fresh_strategy }
|
31
|
+
|
32
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
33
|
+
instance = subject.new('abc', 'def', :authorize_params => {:foo => 'bar', :baz => 'zip'})
|
34
|
+
instance.authorize_params['foo'].should == 'bar'
|
35
|
+
instance.authorize_params['baz'].should == 'zip'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
39
|
+
instance = subject.new('abc', 'def', :authorize_options => [:scope, :foo, :state], :scope => 'bar', :foo => 'baz')
|
40
|
+
instance.authorize_params['scope'].should == 'bar'
|
41
|
+
instance.authorize_params['foo'].should == 'baz'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should include random state in the authorize params' do
|
45
|
+
instance = subject.new('abc', 'def')
|
46
|
+
instance.authorize_params.keys.should == ['state']
|
47
|
+
instance.session['omniauth.state'].should_not be_empty
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#token_params' do
|
52
|
+
subject { fresh_strategy }
|
53
|
+
|
54
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
55
|
+
instance = subject.new('abc', 'def', :token_params => {:foo => 'bar', :baz => 'zip'})
|
56
|
+
instance.token_params.should == {'foo' => 'bar', 'baz' => 'zip'}
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
60
|
+
instance = subject.new('abc', 'def', :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz')
|
61
|
+
instance.token_params.should == {'scope' => 'bar', 'foo' => 'baz'}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'rspec'
|
4
|
+
require 'rack/test'
|
5
|
+
require 'webmock/rspec'
|
6
|
+
require 'omniauth'
|
7
|
+
require 'omniauth-cv'
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.include WebMock::API
|
11
|
+
config.include Rack::Test::Methods
|
12
|
+
config.extend OmniAuth::Test::StrategyMacros, type: :strategy
|
13
|
+
end
|
14
|
+
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-cv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Felix Clack
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-12 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: '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: hashr
|
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: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Provide access to the OAuth2 provider powering SSO for all things CV
|
112
|
+
email:
|
113
|
+
- felixclack@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".rspec"
|
119
|
+
- Gemfile
|
120
|
+
- Gemfile.lock
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- lib/omniauth-cv.rb
|
125
|
+
- lib/omniauth/cv/version.rb
|
126
|
+
- lib/omniauth/strategies/cv.rb
|
127
|
+
- omniauth-cv.gemspec
|
128
|
+
- spec/omniauth/strategies/cv_spec.rb
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
homepage: https://github.com/cvcnetwork/omniauth-cv
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.4.5
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: An OmniAuth strategy for CV
|
154
|
+
test_files:
|
155
|
+
- spec/omniauth/strategies/cv_spec.rb
|
156
|
+
- spec/spec_helper.rb
|