omniauth-azure-oauth2 0.0.6 → 0.0.8
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/.travis.yml +3 -0
- data/CHANGELOG.md +6 -0
- data/README.md +4 -1
- data/lib/omniauth/azure_oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/azure_oauth2.rb +8 -3
- data/omniauth-azure-oauth2.gemspec +1 -1
- data/spec/omniauth/strategies/azure_oauth2_spec.rb +27 -9
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d9149a05139422434d298c3b5a30672d3de6195
|
4
|
+
data.tar.gz: efe71ff9e3b0e07870ea75f10fad2890b0c8c398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 126922706272c0a00bb8330e4b10f264c1490ad98ed075b27e7ae9158ec13af20f200f15dbcb29d29dd2ad93d40c645cd92f8a205ba2018e84b1e5d3cca2c4d3
|
7
|
+
data.tar.gz: e154b9fa94645c9bdffe6cc92b473f0a9d9d8a0e975f4be14004acc3e1afb5418d1411774b881ce8720bfac1a21bfc3b446cc162a370f09f53f17b1860d0a3e1
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Version 0.0.7
|
2
|
+
* Upgrade to omniauth-oauth2 1.4.0 and fix callback url issue
|
3
|
+
* Allow prompt parameter
|
4
|
+
* Add tenant id to info
|
5
|
+
* Updated base url
|
6
|
+
|
1
7
|
# Version 0.0.6
|
2
8
|
* Use 'name' from Azure for name, and 'unique_name' for nickname per Auth Hash spec. Thanks @jayme-github
|
3
9
|
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# OmniAuth Windows Azure Active Directory Strategy
|
2
|
+
[](https://travis-ci.org/KonaTeam/omniauth-azure-oauth2)
|
2
3
|
|
3
4
|
This gem provides a simple way to authenticate to Windows Azure Active Directory (WAAD) over OAuth2 using OmniAuth.
|
4
5
|
|
@@ -140,6 +141,8 @@ end
|
|
140
141
|
5. Push to the branch (`git push origin my-new-feature`)
|
141
142
|
6. Create new Pull Request
|
142
143
|
|
144
|
+
|
143
145
|
## Misc
|
144
146
|
Run tests `bundle exec rake`
|
145
|
-
Push to rubygems `bundle exec rake release`.
|
147
|
+
Push to rubygems `bundle exec rake release`.
|
148
|
+
|
@@ -4,7 +4,7 @@ require 'jwt'
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
6
6
|
class AzureOauth2 < OmniAuth::Strategies::OAuth2
|
7
|
-
BASE_AZURE_URL = 'https://login.
|
7
|
+
BASE_AZURE_URL = 'https://login.microsoftonline.com'
|
8
8
|
|
9
9
|
option :name, 'azure_oauth2'
|
10
10
|
|
@@ -25,10 +25,11 @@ module OmniAuth
|
|
25
25
|
|
26
26
|
options.client_id = provider.client_id
|
27
27
|
options.client_secret = provider.client_secret
|
28
|
-
options.tenant_id =
|
28
|
+
options.tenant_id =
|
29
29
|
provider.respond_to?(:tenant_id) ? provider.tenant_id : 'common'
|
30
30
|
|
31
31
|
options.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint
|
32
|
+
options.authorize_params.prompt = request.params['prompt'] if request.params['prompt']
|
32
33
|
options.client_options.authorize_url = "#{BASE_AZURE_URL}/#{options.tenant_id}/oauth2/authorize"
|
33
34
|
options.client_options.token_url = "#{BASE_AZURE_URL}/#{options.tenant_id}/oauth2/token"
|
34
35
|
|
@@ -47,10 +48,14 @@ module OmniAuth
|
|
47
48
|
first_name: raw_info['given_name'],
|
48
49
|
last_name: raw_info['family_name'],
|
49
50
|
email: raw_info['email'] || raw_info['upn'],
|
50
|
-
oid: raw_info['oid']
|
51
|
+
oid: raw_info['oid'],
|
52
|
+
tid: raw_info['tid']
|
51
53
|
}
|
52
54
|
end
|
53
55
|
|
56
|
+
def callback_url
|
57
|
+
full_host + script_name + callback_path
|
58
|
+
end
|
54
59
|
|
55
60
|
def raw_info
|
56
61
|
# it's all here in JWT http://msdn.microsoft.com/en-us/library/azure/dn195587.aspx
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency 'omniauth', '~> 1.0'
|
20
20
|
gem.add_dependency 'jwt', '~> 1.0'
|
21
21
|
|
22
|
-
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.
|
22
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.4'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'rspec', '>= 2.14.0'
|
25
25
|
gem.add_development_dependency 'rake'
|
@@ -31,19 +31,23 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
31
31
|
|
32
32
|
describe '#client' do
|
33
33
|
it 'has correct authorize url' do
|
34
|
-
|
34
|
+
allow(subject).to receive(:request) { request }
|
35
|
+
expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/authorize')
|
35
36
|
end
|
36
37
|
|
37
38
|
it 'has correct authorize params' do
|
39
|
+
allow(subject).to receive(:request) { request }
|
38
40
|
subject.client
|
39
41
|
expect(subject.authorize_params[:domain_hint]).to be_nil
|
40
42
|
end
|
41
43
|
|
42
44
|
it 'has correct token url' do
|
43
|
-
|
45
|
+
allow(subject).to receive(:request) { request }
|
46
|
+
expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/token')
|
44
47
|
end
|
45
48
|
|
46
49
|
it 'has correct token params' do
|
50
|
+
allow(subject).to receive(:request) { request }
|
47
51
|
subject.client
|
48
52
|
expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000')
|
49
53
|
end
|
@@ -51,6 +55,7 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
51
55
|
describe "overrides" do
|
52
56
|
it 'should override domain_hint' do
|
53
57
|
@options = {domain_hint: 'hint'}
|
58
|
+
allow(subject).to receive(:request) { request }
|
54
59
|
subject.client
|
55
60
|
expect(subject.authorize_params[:domain_hint]).to eql('hint')
|
56
61
|
end
|
@@ -65,13 +70,17 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
65
70
|
OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret'}.merge(options))
|
66
71
|
end
|
67
72
|
|
73
|
+
before do
|
74
|
+
allow(subject).to receive(:request) { request }
|
75
|
+
end
|
76
|
+
|
68
77
|
describe '#client' do
|
69
78
|
it 'has correct authorize url' do
|
70
|
-
expect(subject.client.options[:authorize_url]).to eql('https://login.
|
79
|
+
expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/common/oauth2/authorize')
|
71
80
|
end
|
72
81
|
|
73
82
|
it 'has correct token url' do
|
74
|
-
expect(subject.client.options[:token_url]).to eql('https://login.
|
83
|
+
expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/common/oauth2/token')
|
75
84
|
end
|
76
85
|
end
|
77
86
|
end
|
@@ -101,9 +110,13 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
101
110
|
OmniAuth::Strategies::AzureOauth2.new(app, provider_klass)
|
102
111
|
end
|
103
112
|
|
113
|
+
before do
|
114
|
+
allow(subject).to receive(:request) { request }
|
115
|
+
end
|
116
|
+
|
104
117
|
describe '#client' do
|
105
118
|
it 'has correct authorize url' do
|
106
|
-
expect(subject.client.options[:authorize_url]).to eql('https://login.
|
119
|
+
expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/authorize')
|
107
120
|
end
|
108
121
|
|
109
122
|
it 'has correct authorize params' do
|
@@ -112,7 +125,7 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
112
125
|
end
|
113
126
|
|
114
127
|
it 'has correct token url' do
|
115
|
-
expect(subject.client.options[:token_url]).to eql('https://login.
|
128
|
+
expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/token')
|
116
129
|
end
|
117
130
|
|
118
131
|
it 'has correct token params' do
|
@@ -152,13 +165,17 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
152
165
|
OmniAuth::Strategies::AzureOauth2.new(app, provider_klass)
|
153
166
|
end
|
154
167
|
|
168
|
+
before do
|
169
|
+
allow(subject).to receive(:request) { request }
|
170
|
+
end
|
171
|
+
|
155
172
|
describe '#client' do
|
156
173
|
it 'has correct authorize url' do
|
157
|
-
expect(subject.client.options[:authorize_url]).to eql('https://login.
|
174
|
+
expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/common/oauth2/authorize')
|
158
175
|
end
|
159
176
|
|
160
177
|
it 'has correct token url' do
|
161
|
-
expect(subject.client.options[:token_url]).to eql('https://login.
|
178
|
+
expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/common/oauth2/token')
|
162
179
|
end
|
163
180
|
end
|
164
181
|
end
|
@@ -176,8 +193,9 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
176
193
|
double(:token => token)
|
177
194
|
end
|
178
195
|
|
179
|
-
before
|
196
|
+
before do
|
180
197
|
allow(subject).to receive(:access_token) { access_token }
|
198
|
+
allow(subject).to receive(:request) { request }
|
181
199
|
end
|
182
200
|
|
183
201
|
it "does not clash if JWT strategy is used" do
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-azure-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Nadig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jwt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: omniauth-oauth2
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.14.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.14.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: An Windows Azure Active Directory OAuth2 strategy for OmniAuth
|
@@ -87,7 +87,8 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
91
92
|
- CHANGELOG.md
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE
|
@@ -111,17 +112,17 @@ require_paths:
|
|
111
112
|
- lib
|
112
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- -
|
115
|
+
- - ">="
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
119
|
requirements:
|
119
|
-
- -
|
120
|
+
- - ">="
|
120
121
|
- !ruby/object:Gem::Version
|
121
122
|
version: '0'
|
122
123
|
requirements: []
|
123
124
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.4.
|
125
|
+
rubygems_version: 2.4.8
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: An Windows Azure Active Directory OAuth2 strategy for OmniAuth
|