omniauth-outrightmental 0.1.5 → 0.1.7
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/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/lib/omniauth-outrightmental/version.rb +1 -1
- data/lib/omniauth/strategies/outrightmental.rb +2 -2
- data/omniauth-outrightmental.gemspec +3 -3
- data/spec/omniauth/strategies/outrightmental_spec.rb +48 -35
- metadata +25 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1dd67701a99978088605092a20b00e80dc4906a2
|
4
|
+
data.tar.gz: 3f6962efd398eb362a3f9f11304f03a227ee5013
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae03ccfc165c558b8d719a1c3a8a412cf98700c8bab0f8adb7d5d23fda4689aecae13fc5c18105f77d95aac460e1ffbb6bc8a91bb33d7b957a736c147b2714c4
|
7
|
+
data.tar.gz: cf63e47a84147a26697e4ff6cb53ed7260d3c27046ff2f821c7ad33ed85ddb9b9c44e184676228ec5c2a564d86b6c736b96cf15dc9fe4e9101a8c3b5aa4fb3da
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.5
|
data/.travis.yml
ADDED
@@ -5,8 +5,8 @@ module OmniAuth
|
|
5
5
|
class OutrightMental < OmniAuth::Strategies::OAuth2
|
6
6
|
option :client_options, {
|
7
7
|
:site => 'https://ont.io/',
|
8
|
-
:authorize_url => 'https://ont.io
|
9
|
-
:token_url => 'https://ont.io
|
8
|
+
:authorize_url => 'https://ont.io/oauth/authorize',
|
9
|
+
:token_url => 'https://ont.io/oauth/token'
|
10
10
|
}
|
11
11
|
|
12
12
|
def request_phase
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
# http://www.rubysec.com/advisories/CVE-2012-6134/
|
22
22
|
gem.add_dependency 'omniauth-oauth2', '>= 1.1.1', '< 2.0'
|
23
23
|
gem.add_development_dependency 'rspec', '~> 2.7'
|
24
|
-
gem.add_development_dependency 'rack-test'
|
25
|
-
gem.add_development_dependency 'simplecov'
|
26
|
-
gem.add_development_dependency 'webmock'
|
24
|
+
gem.add_development_dependency 'rack-test', '~> 0'
|
25
|
+
gem.add_development_dependency 'simplecov', '~> 0'
|
26
|
+
gem.add_development_dependency 'webmock', '~> 0'
|
27
27
|
end
|
@@ -21,24 +21,23 @@ describe OmniAuth::Strategies::OutrightMental do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
subject do
|
24
|
-
OmniAuth::Strategies::OutrightMental
|
25
|
-
end
|
26
|
-
|
27
|
-
before(:each) do
|
28
|
-
subject.stub(:access_token).and_return(access_token)
|
24
|
+
OmniAuth::Strategies::OutrightMental
|
29
25
|
end
|
30
26
|
|
31
27
|
context "client options" do
|
32
28
|
it 'should have correct site' do
|
33
|
-
subject.
|
29
|
+
instance = subject.new({})
|
30
|
+
instance.options.client_options.site.should eq("https://ont.io/")
|
34
31
|
end
|
35
32
|
|
36
33
|
it 'should have correct authorize url' do
|
37
|
-
subject.
|
34
|
+
instance = subject.new({})
|
35
|
+
instance.options.client_options.authorize_url.should eq('https://ont.io/oauth/authorize')
|
38
36
|
end
|
39
37
|
|
40
38
|
it 'should have correct token url' do
|
41
|
-
subject.
|
39
|
+
instance = subject.new({})
|
40
|
+
instance.options.client_options.token_url.should eq('https://ont.io/oauth/token')
|
42
41
|
end
|
43
42
|
|
44
43
|
describe "should be overrideable" do
|
@@ -58,84 +57,98 @@ describe OmniAuth::Strategies::OutrightMental do
|
|
58
57
|
|
59
58
|
context "#email_access_allowed?" do
|
60
59
|
it "should not allow email if scope is nil" do
|
61
|
-
subject.
|
62
|
-
|
60
|
+
instance = subject.new({})
|
61
|
+
instance.options['scope'].should be_nil
|
62
|
+
instance.should_not be_email_access_allowed
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should allow email if scope is user" do
|
66
|
-
|
67
|
-
|
66
|
+
instance = subject.new({})
|
67
|
+
instance.options['scope'] = 'user'
|
68
|
+
instance.should be_email_access_allowed
|
68
69
|
end
|
69
70
|
|
70
71
|
it "should allow email if scope is a bunch of stuff including user" do
|
71
|
-
|
72
|
-
|
72
|
+
instance = subject.new({})
|
73
|
+
instance.options['scope'] = 'public_repo,user,repo,delete_repo,gist'
|
74
|
+
instance.should be_email_access_allowed
|
73
75
|
end
|
74
76
|
|
75
77
|
it "should not allow email if scope does not grant email access" do
|
76
|
-
|
77
|
-
|
78
|
+
instance = subject.new({})
|
79
|
+
instance.options['scope'] = 'repo,user:follow'
|
80
|
+
instance.should_not be_email_access_allowed
|
78
81
|
end
|
79
82
|
|
80
83
|
it "should assume email access not allowed if scope is something currently not documented " do
|
81
|
-
|
82
|
-
|
84
|
+
instance = subject.new({})
|
85
|
+
instance.options['scope'] = 'currently_not_documented'
|
86
|
+
instance.should_not be_email_access_allowed
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
86
90
|
context "#email" do
|
87
91
|
it "should return email from raw_info if available" do
|
88
|
-
subject.
|
89
|
-
|
92
|
+
instance = subject.new({})
|
93
|
+
instance.stub(:raw_info).and_return({'email' => 'you@example.com'})
|
94
|
+
instance.email.should eq('you@example.com')
|
90
95
|
end
|
91
96
|
|
92
97
|
it "should return nil if there is no raw_info and email access is not allowed" do
|
93
|
-
subject.
|
94
|
-
|
98
|
+
instance = subject.new({})
|
99
|
+
instance.stub(:raw_info).and_return({})
|
100
|
+
instance.email.should be_nil
|
95
101
|
end
|
96
102
|
|
97
103
|
it "should return the primary email if there is no raw_info and email access is allowed" do
|
104
|
+
instance = subject.new({})
|
98
105
|
emails = [
|
99
106
|
{ 'email' => 'secondary@example.com', 'primary' => false },
|
100
107
|
{ 'email' => 'primary@example.com', 'primary' => true }
|
101
108
|
]
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
109
|
+
instance.stub(:raw_info).and_return({})
|
110
|
+
instance.options['scope'] = 'user'
|
111
|
+
instance.stub(:emails).and_return(emails)
|
112
|
+
instance.email.should eq('primary@example.com')
|
106
113
|
end
|
107
114
|
|
108
115
|
it "should return the first email if there is no raw_info and email access is allowed" do
|
116
|
+
instance = subject.new({})
|
109
117
|
emails = [
|
110
118
|
{ 'email' => 'first@example.com', 'primary' => false },
|
111
119
|
{ 'email' => 'second@example.com', 'primary' => false }
|
112
120
|
]
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
121
|
+
instance.stub(:raw_info).and_return({})
|
122
|
+
instance.options['scope'] = 'user'
|
123
|
+
instance.stub(:emails).and_return(emails)
|
124
|
+
instance.email.should eq('first@example.com')
|
117
125
|
end
|
118
126
|
end
|
119
127
|
|
120
128
|
context "#raw_info" do
|
121
129
|
it "should use relative paths" do
|
130
|
+
instance = subject.new({})
|
131
|
+
instance.stub(:access_token).and_return(access_token)
|
122
132
|
access_token.should_receive(:get).with('user').and_return(response)
|
123
|
-
|
133
|
+
instance.raw_info.should eq(parsed_response)
|
124
134
|
end
|
125
135
|
end
|
126
136
|
|
127
137
|
context "#emails" do
|
128
138
|
it "should use relative paths" do
|
139
|
+
instance = subject.new({})
|
140
|
+
instance.stub(:access_token).and_return(access_token)
|
129
141
|
access_token.should_receive(:get).with('user/emails', :headers=>{"Accept"=>"application/vnd.outrightmental.v1"}).and_return(response)
|
130
|
-
|
131
|
-
|
142
|
+
instance.options['scope'] = 'user'
|
143
|
+
instance.emails.should eq(parsed_response)
|
132
144
|
end
|
133
145
|
end
|
134
146
|
|
135
147
|
context '#info.urls' do
|
136
148
|
it 'should use html_url from raw_info' do
|
137
|
-
subject.
|
138
|
-
|
149
|
+
instance = subject.new({})
|
150
|
+
instance.stub(:raw_info).and_return({ 'login' => 'me', 'html_url' => 'http://enterprise/me' })
|
151
|
+
instance.info['urls']['OutrightMental'].should == 'http://enterprise/me'
|
139
152
|
end
|
140
153
|
end
|
141
154
|
|
metadata
CHANGED
@@ -1,116 +1,103 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-outrightmental
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Outright Mental Inc.
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: omniauth
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: omniauth-oauth2
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 1.1.1
|
38
|
-
- - <
|
34
|
+
- - "<"
|
39
35
|
- !ruby/object:Gem::Version
|
40
36
|
version: '2.0'
|
41
37
|
type: :runtime
|
42
38
|
prerelease: false
|
43
39
|
version_requirements: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
40
|
requirements:
|
46
|
-
- -
|
41
|
+
- - ">="
|
47
42
|
- !ruby/object:Gem::Version
|
48
43
|
version: 1.1.1
|
49
|
-
- - <
|
44
|
+
- - "<"
|
50
45
|
- !ruby/object:Gem::Version
|
51
46
|
version: '2.0'
|
52
47
|
- !ruby/object:Gem::Dependency
|
53
48
|
name: rspec
|
54
49
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
50
|
requirements:
|
57
|
-
- - ~>
|
51
|
+
- - "~>"
|
58
52
|
- !ruby/object:Gem::Version
|
59
53
|
version: '2.7'
|
60
54
|
type: :development
|
61
55
|
prerelease: false
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
57
|
requirements:
|
65
|
-
- - ~>
|
58
|
+
- - "~>"
|
66
59
|
- !ruby/object:Gem::Version
|
67
60
|
version: '2.7'
|
68
61
|
- !ruby/object:Gem::Dependency
|
69
62
|
name: rack-test
|
70
63
|
requirement: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
64
|
requirements:
|
73
|
-
- -
|
65
|
+
- - "~>"
|
74
66
|
- !ruby/object:Gem::Version
|
75
67
|
version: '0'
|
76
68
|
type: :development
|
77
69
|
prerelease: false
|
78
70
|
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
71
|
requirements:
|
81
|
-
- -
|
72
|
+
- - "~>"
|
82
73
|
- !ruby/object:Gem::Version
|
83
74
|
version: '0'
|
84
75
|
- !ruby/object:Gem::Dependency
|
85
76
|
name: simplecov
|
86
77
|
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
78
|
requirements:
|
89
|
-
- -
|
79
|
+
- - "~>"
|
90
80
|
- !ruby/object:Gem::Version
|
91
81
|
version: '0'
|
92
82
|
type: :development
|
93
83
|
prerelease: false
|
94
84
|
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
85
|
requirements:
|
97
|
-
- -
|
86
|
+
- - "~>"
|
98
87
|
- !ruby/object:Gem::Version
|
99
88
|
version: '0'
|
100
89
|
- !ruby/object:Gem::Dependency
|
101
90
|
name: webmock
|
102
91
|
requirement: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
92
|
requirements:
|
105
|
-
- -
|
93
|
+
- - "~>"
|
106
94
|
- !ruby/object:Gem::Version
|
107
95
|
version: '0'
|
108
96
|
type: :development
|
109
97
|
prerelease: false
|
110
98
|
version_requirements: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
99
|
requirements:
|
113
|
-
- -
|
100
|
+
- - "~>"
|
114
101
|
- !ruby/object:Gem::Version
|
115
102
|
version: '0'
|
116
103
|
description: Official OmniAuth strategy for Outright Mental Inc.
|
@@ -120,8 +107,10 @@ executables: []
|
|
120
107
|
extensions: []
|
121
108
|
extra_rdoc_files: []
|
122
109
|
files:
|
123
|
-
- .gitignore
|
124
|
-
- .rspec
|
110
|
+
- ".gitignore"
|
111
|
+
- ".rspec"
|
112
|
+
- ".ruby-version"
|
113
|
+
- ".travis.yml"
|
125
114
|
- Gemfile
|
126
115
|
- Guardfile
|
127
116
|
- LICENSE.txt
|
@@ -136,26 +125,25 @@ files:
|
|
136
125
|
homepage: https://github.com/outrightmental/omniauth-outrightmental
|
137
126
|
licenses:
|
138
127
|
- MIT
|
128
|
+
metadata: {}
|
139
129
|
post_install_message:
|
140
130
|
rdoc_options: []
|
141
131
|
require_paths:
|
142
132
|
- lib
|
143
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
134
|
requirements:
|
146
|
-
- -
|
135
|
+
- - ">="
|
147
136
|
- !ruby/object:Gem::Version
|
148
137
|
version: '0'
|
149
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
-
none: false
|
151
139
|
requirements:
|
152
|
-
- -
|
140
|
+
- - ">="
|
153
141
|
- !ruby/object:Gem::Version
|
154
142
|
version: '0'
|
155
143
|
requirements: []
|
156
144
|
rubyforge_project:
|
157
|
-
rubygems_version:
|
145
|
+
rubygems_version: 2.2.2
|
158
146
|
signing_key:
|
159
|
-
specification_version:
|
147
|
+
specification_version: 4
|
160
148
|
summary: Login with Outright Mental in order to experience our media.
|
161
149
|
test_files: []
|