omniauth-mlh 0.4.1 → 1.0.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 +4 -4
- data/.rubocop.yml +12 -0
- data/.travis.yml +1 -1
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/lib/omniauth/strategies/mlh.rb +16 -5
- data/lib/omniauth-mlh/version.rb +3 -5
- data/lib/omniauth-mlh.rb +5 -3
- data/omniauth-mlh.gemspec +21 -16
- data/spec/omniauth/mlh_spec.rb +7 -5
- data/spec/spec_helper.rb +6 -3
- data/spec/support/shared_examples.rb +7 -5
- metadata +49 -21
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 622c9053382357ade0f161e78ed3f13ae01ae9f939b9bae87b43ff3281b618e2
|
4
|
+
data.tar.gz: bc057ee83655fcac77978e15a21891013981853cebc8e7c235d08601468d8156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4cd23553337c4dc6537a4c432c61d00f84334cd0d0372d7c3148b0c85bf175834a97ac9e213623e17541349f16b15e4489bfe0f8658302ae7fc01d71e4ad76f
|
7
|
+
data.tar.gz: fb197ac156fb8a6ff76c8ce5b7e01ba016ff3859ad3741cd10da11932c274c7dc33c0f1dffbc766e0479cc4607d29621267e942ed1d26f22df37bdbb8f432050
|
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'omniauth-oauth2'
|
2
4
|
require 'ostruct'
|
3
5
|
|
4
6
|
module OmniAuth
|
5
7
|
module Strategies
|
6
|
-
class MLH < OmniAuth::Strategies::OAuth2
|
8
|
+
class MLH < OmniAuth::Strategies::OAuth2 # :nodoc:
|
7
9
|
option :name, :mlh
|
8
10
|
|
9
11
|
option :client_options, {
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
12
|
+
site: 'https://my.mlh.io',
|
13
|
+
authorize_url: 'oauth/authorize',
|
14
|
+
token_url: 'oauth/token'
|
13
15
|
}
|
14
16
|
|
15
17
|
uid { data[:id] }
|
@@ -26,16 +28,25 @@ module OmniAuth
|
|
26
28
|
:date_of_birth,
|
27
29
|
:gender,
|
28
30
|
:phone_number,
|
31
|
+
:profession_type,
|
32
|
+
:company_name,
|
33
|
+
:company_title,
|
29
34
|
:scopes,
|
30
35
|
:school
|
31
36
|
)
|
32
37
|
end
|
33
38
|
|
34
39
|
def data
|
35
|
-
@data ||=
|
40
|
+
@data ||= begin
|
41
|
+
access_token.get('/api/v3/user.json').parsed.deep_symbolize_keys[:data]
|
42
|
+
rescue StandardError
|
43
|
+
{}
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
40
49
|
|
41
50
|
OmniAuth.config.add_camelization 'mlh', 'MLH'
|
51
|
+
OmniAuth.config.allowed_request_methods = %i[post get]
|
52
|
+
OmniAuth.config.silence_get_warning = true
|
data/lib/omniauth-mlh/version.rb
CHANGED
data/lib/omniauth-mlh.rb
CHANGED
data/omniauth-mlh.gemspec
CHANGED
@@ -1,33 +1,38 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
4
6
|
require 'omniauth-mlh/version'
|
5
7
|
|
6
8
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
9
|
+
spec.name = 'omniauth-mlh'
|
8
10
|
spec.version = OmniAuth::MLH::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
+
spec.authors = ['Swift']
|
12
|
+
spec.email = ['swift@mlh.io']
|
11
13
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
14
|
+
spec.summary = 'Official OmniAuth strategy for MyMLH.'
|
15
|
+
spec.description = 'Official OmniAuth strategy for MyMLH.'
|
16
|
+
spec.homepage = 'http://github.com/mlh/omniauth-mlh'
|
17
|
+
spec.license = 'MIT'
|
16
18
|
|
17
|
-
spec.required_ruby_version = '>= 2.2.
|
19
|
+
spec.required_ruby_version = '>= 2.2.0'
|
18
20
|
|
19
|
-
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
20
22
|
spec.files = `git ls-files`.split("\n")
|
21
23
|
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
-
spec.require_paths = [
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.add_dependency 'oauth2', '~> 2.0.9'
|
27
|
+
spec.add_dependency 'omniauth', '~> 2.1.1'
|
28
|
+
spec.add_dependency 'omniauth-oauth2', '~> 1.8.0'
|
29
|
+
spec.add_dependency 'omniauth-rails_csrf_protection', '~> 1.0.1'
|
23
30
|
|
24
|
-
spec.add_dependency 'omniauth', '~> 1.0'
|
25
|
-
spec.add_dependency 'omniauth-oauth2', '~> 1.3.1'
|
26
31
|
spec.add_dependency 'activesupport'
|
27
32
|
|
28
|
-
spec.add_development_dependency 'rspec', '~> 2.7'
|
29
|
-
spec.add_development_dependency 'rake', '~> 10.5'
|
30
33
|
spec.add_development_dependency 'rack-test'
|
34
|
+
spec.add_development_dependency 'rake', '~> 10.5'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 2.7'
|
31
36
|
spec.add_development_dependency 'simplecov'
|
32
37
|
spec.add_development_dependency 'webmock'
|
33
38
|
end
|
data/spec/omniauth/mlh_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe OmniAuth::MLH do
|
@@ -13,23 +15,23 @@ describe OmniAuth::MLH do
|
|
13
15
|
end
|
14
16
|
|
15
17
|
it 'has correct authorize url' do
|
16
|
-
expect(subject.client.options[:authorize_url]).to eq('
|
18
|
+
expect(subject.client.options[:authorize_url]).to eq('oauth/authorize')
|
17
19
|
end
|
18
20
|
|
19
21
|
it 'has correct token url' do
|
20
|
-
expect(subject.client.options[:token_url]).to eq('
|
22
|
+
expect(subject.client.options[:token_url]).to eq('oauth/token')
|
21
23
|
end
|
22
24
|
|
23
25
|
it 'runs the setup block if passed one' do
|
24
26
|
counter = ''
|
25
|
-
@options = { :
|
27
|
+
@options = { setup: proc { |_env| counter = 'ok' } }
|
26
28
|
subject.setup_phase
|
27
|
-
expect(counter).to eq(
|
29
|
+
expect(counter).to eq('ok')
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
33
|
describe '#callback_path' do
|
32
|
-
it
|
34
|
+
it 'has the correct callback path' do
|
33
35
|
expect(subject.callback_path).to eq('/auth/mlh/callback')
|
34
36
|
end
|
35
37
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
2
4
|
|
3
5
|
require 'simplecov'
|
4
6
|
SimpleCov.start
|
@@ -9,12 +11,13 @@ require 'rack/test'
|
|
9
11
|
require 'webmock/rspec'
|
10
12
|
require 'omniauth'
|
11
13
|
require 'omniauth-mlh'
|
12
|
-
|
14
|
+
|
15
|
+
Dir[File.expand_path('support/**/*', __dir__)].sort.each { |f| require f }
|
13
16
|
|
14
17
|
RSpec.configure do |config|
|
15
18
|
config.include WebMock::API
|
16
19
|
config.include Rack::Test::Methods
|
17
|
-
config.extend OmniAuth::Test::StrategyMacros, :
|
20
|
+
config.extend OmniAuth::Test::StrategyMacros, type: :strategy
|
18
21
|
|
19
22
|
OmniAuth.config.test_mode = true
|
20
23
|
end
|
@@ -1,23 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Credit: https://github.com/datariot/omniauth-paypal/blob/master/spec/support/shared_examples.rb
|
2
4
|
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
3
5
|
|
4
6
|
shared_examples 'an oauth2 strategy' do
|
5
7
|
describe '#client' do
|
6
8
|
it 'should be initialized with symbolized client_options' do
|
7
|
-
@options = { :
|
9
|
+
@options = { client_options: { 'authorize_url' => 'https://example.com' } }
|
8
10
|
expect(subject.client.options[:authorize_url]).to eq('https://example.com')
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
14
|
describe '#authorize_params' do
|
13
15
|
it 'should include any authorize params passed in the :authorize_params option' do
|
14
|
-
@options = { :
|
16
|
+
@options = { authorize_params: { foo: 'bar', baz: 'zip' } }
|
15
17
|
expect(subject.authorize_params['foo']).to eq('bar')
|
16
18
|
expect(subject.authorize_params['baz']).to eq('zip')
|
17
19
|
end
|
18
20
|
|
19
21
|
it 'should include top-level options that are marked as :authorize_options' do
|
20
|
-
@options = { :
|
22
|
+
@options = { authorize_options: %i[scope foo], scope: 'bar', foo: 'baz' }
|
21
23
|
expect(subject.authorize_params['scope']).to eq('bar')
|
22
24
|
expect(subject.authorize_params['foo']).to eq('baz')
|
23
25
|
end
|
@@ -25,13 +27,13 @@ shared_examples 'an oauth2 strategy' do
|
|
25
27
|
|
26
28
|
describe '#token_params' do
|
27
29
|
it 'should include any token params passed in the :token_params option' do
|
28
|
-
@options = { :
|
30
|
+
@options = { token_params: { foo: 'bar', baz: 'zip' } }
|
29
31
|
expect(subject.token_params['foo']).to eq('bar')
|
30
32
|
expect(subject.token_params['baz']).to eq('zip')
|
31
33
|
end
|
32
34
|
|
33
35
|
it 'should include top-level options that are marked as :token_options' do
|
34
|
-
@options = { :
|
36
|
+
@options = { token_options: %i[scope foo], scope: 'bar', foo: 'baz' }
|
35
37
|
expect(subject.token_params['scope']).to eq('bar')
|
36
38
|
expect(subject.token_params['foo']).to eq('baz')
|
37
39
|
end
|
metadata
CHANGED
@@ -1,43 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-mlh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swift
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.9
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.9
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: omniauth
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
33
|
+
version: 2.1.1
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
40
|
+
version: 2.1.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: omniauth-oauth2
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
47
|
+
version: 1.8.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.8.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: omniauth-rails_csrf_protection
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.1
|
34
62
|
type: :runtime
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
68
|
+
version: 1.0.1
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: activesupport
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,19 +81,19 @@ dependencies:
|
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: rack-test
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
|
-
- - "
|
87
|
+
- - ">="
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
89
|
+
version: '0'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
|
-
- - "
|
94
|
+
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rake
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,19 +109,19 @@ dependencies:
|
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '10.5'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
112
|
+
name: rspec
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
|
-
- - "
|
115
|
+
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
117
|
+
version: '2.7'
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
|
-
- - "
|
122
|
+
- - "~>"
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
124
|
+
version: '2.7'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: simplecov
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +150,7 @@ dependencies:
|
|
122
150
|
- - ">="
|
123
151
|
- !ruby/object:Gem::Version
|
124
152
|
version: '0'
|
125
|
-
description: Official OmniAuth strategy for
|
153
|
+
description: Official OmniAuth strategy for MyMLH.
|
126
154
|
email:
|
127
155
|
- swift@mlh.io
|
128
156
|
executables: []
|
@@ -131,7 +159,7 @@ extra_rdoc_files: []
|
|
131
159
|
files:
|
132
160
|
- ".gitignore"
|
133
161
|
- ".rspec"
|
134
|
-
- ".
|
162
|
+
- ".rubocop.yml"
|
135
163
|
- ".travis.yml"
|
136
164
|
- Gemfile
|
137
165
|
- LICENSE.txt
|
@@ -156,17 +184,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
184
|
requirements:
|
157
185
|
- - ">="
|
158
186
|
- !ruby/object:Gem::Version
|
159
|
-
version: 2.2.
|
187
|
+
version: 2.2.0
|
160
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
189
|
requirements:
|
162
190
|
- - ">="
|
163
191
|
- !ruby/object:Gem::Version
|
164
192
|
version: '0'
|
165
193
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
194
|
+
rubygems_version: 3.2.33
|
167
195
|
signing_key:
|
168
196
|
specification_version: 4
|
169
|
-
summary: Official OmniAuth strategy for
|
197
|
+
summary: Official OmniAuth strategy for MyMLH.
|
170
198
|
test_files:
|
171
199
|
- spec/omniauth/mlh_spec.rb
|
172
200
|
- spec/spec_helper.rb
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.2.4
|