omniauth-azure-oauth2 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bee864f23443c93668213276a72f72f0303587a
|
4
|
+
data.tar.gz: 820bdf249f54726683c44d6e2ea032c7b76ea147
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1a1c080c1e85a7f74b5f4606c26eae1a48cd0c70fab15551c50833ab2a837fd932cb1450131a4745daad1e15ef77c2a2af5752968f99dee777030a38cebb1f5
|
7
|
+
data.tar.gz: 945d2872c93387bbc15baf598cc96fb41904c5ff8c7f2c221b0ece0d8a89a46fe986ef8807283a44528117805d0a36ff0dbdb3f9fbd33248e83d32b02dae197b
|
data/CHANGELOG.md
CHANGED
@@ -27,15 +27,14 @@ module OmniAuth
|
|
27
27
|
options.client_secret = provider.client_secret
|
28
28
|
options.tenant_id =
|
29
29
|
provider.respond_to?(:tenant_id) ? provider.tenant_id : 'common'
|
30
|
-
options.base_azure_url =
|
30
|
+
options.base_azure_url =
|
31
31
|
provider.respond_to?(:base_azure_url) ? provider.base_azure_url : BASE_AZURE_URL
|
32
32
|
|
33
|
+
options.authorize_params = provider.authorize_params if provider.respond_to?(:authorize_params)
|
33
34
|
options.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint
|
34
35
|
options.authorize_params.prompt = request.params['prompt'] if request.params['prompt']
|
35
36
|
options.client_options.authorize_url = "#{options.base_azure_url}/#{options.tenant_id}/oauth2/authorize"
|
36
37
|
options.client_options.token_url = "#{options.base_azure_url}/#{options.tenant_id}/oauth2/token"
|
37
|
-
|
38
|
-
options.token_params.resource = options.resource
|
39
38
|
super
|
40
39
|
end
|
41
40
|
|
@@ -55,6 +54,11 @@ module OmniAuth
|
|
55
54
|
}
|
56
55
|
end
|
57
56
|
|
57
|
+
def token_params
|
58
|
+
azure_resource = request.env['omniauth.params'] && request.env['omniauth.params']['azure_resource']
|
59
|
+
super.merge(resource: azure_resource || options.resource)
|
60
|
+
end
|
61
|
+
|
58
62
|
def callback_url
|
59
63
|
full_host + script_name + callback_path
|
60
64
|
end
|
@@ -46,12 +46,6 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
46
46
|
expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/token')
|
47
47
|
end
|
48
48
|
|
49
|
-
it 'has correct token params' do
|
50
|
-
allow(subject).to receive(:request) { request }
|
51
|
-
subject.client
|
52
|
-
expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000')
|
53
|
-
end
|
54
|
-
|
55
49
|
describe "overrides" do
|
56
50
|
it 'should override domain_hint' do
|
57
51
|
@options = {domain_hint: 'hint'}
|
@@ -69,30 +63,30 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
69
63
|
subject do
|
70
64
|
OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret', tenant_id: 'tenant', base_azure_url: 'https://login.microsoftonline.de'}.merge(options))
|
71
65
|
end
|
72
|
-
|
66
|
+
|
73
67
|
describe '#client' do
|
74
68
|
it 'has correct authorize url' do
|
75
69
|
allow(subject).to receive(:request) { request }
|
76
70
|
expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/authorize')
|
77
71
|
end
|
78
|
-
|
72
|
+
|
79
73
|
it 'has correct authorize params' do
|
80
74
|
allow(subject).to receive(:request) { request }
|
81
75
|
subject.client
|
82
76
|
expect(subject.authorize_params[:domain_hint]).to be_nil
|
83
77
|
end
|
84
|
-
|
78
|
+
|
85
79
|
it 'has correct token url' do
|
86
80
|
allow(subject).to receive(:request) { request }
|
87
81
|
expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/token')
|
88
82
|
end
|
89
|
-
|
83
|
+
|
90
84
|
it 'has correct token params' do
|
91
85
|
allow(subject).to receive(:request) { request }
|
92
86
|
subject.client
|
93
87
|
expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000')
|
94
88
|
end
|
95
|
-
|
89
|
+
|
96
90
|
describe "overrides" do
|
97
91
|
it 'should override domain_hint' do
|
98
92
|
@options = {domain_hint: 'hint'}
|
@@ -103,7 +97,7 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
103
97
|
end
|
104
98
|
end
|
105
99
|
end
|
106
|
-
|
100
|
+
|
107
101
|
describe 'static common configuration' do
|
108
102
|
let(:options) { @options || {} }
|
109
103
|
subject do
|
@@ -143,6 +137,9 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
143
137
|
'tenant'
|
144
138
|
end
|
145
139
|
|
140
|
+
def authorize_params
|
141
|
+
{ custom_option: 'value' }
|
142
|
+
end
|
146
143
|
}
|
147
144
|
}
|
148
145
|
|
@@ -162,6 +159,7 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
162
159
|
it 'has correct authorize params' do
|
163
160
|
subject.client
|
164
161
|
expect(subject.authorize_params[:domain_hint]).to be_nil
|
162
|
+
expect(subject.authorize_params[:custom_option]).to eql('value')
|
165
163
|
end
|
166
164
|
|
167
165
|
it 'has correct token url' do
|
@@ -190,52 +188,52 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
190
188
|
Class.new {
|
191
189
|
def initialize(strategy)
|
192
190
|
end
|
193
|
-
|
191
|
+
|
194
192
|
def client_id
|
195
193
|
'id'
|
196
194
|
end
|
197
|
-
|
195
|
+
|
198
196
|
def client_secret
|
199
197
|
'secret'
|
200
198
|
end
|
201
|
-
|
199
|
+
|
202
200
|
def tenant_id
|
203
201
|
'tenant'
|
204
202
|
end
|
205
|
-
|
203
|
+
|
206
204
|
def base_azure_url
|
207
205
|
'https://login.microsoftonline.de'
|
208
206
|
end
|
209
207
|
}
|
210
208
|
}
|
211
|
-
|
209
|
+
|
212
210
|
subject do
|
213
211
|
OmniAuth::Strategies::AzureOauth2.new(app, provider_klass)
|
214
212
|
end
|
215
|
-
|
213
|
+
|
216
214
|
before do
|
217
215
|
allow(subject).to receive(:request) { request }
|
218
216
|
end
|
219
|
-
|
217
|
+
|
220
218
|
describe '#client' do
|
221
219
|
it 'has correct authorize url' do
|
222
220
|
expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/authorize')
|
223
221
|
end
|
224
|
-
|
222
|
+
|
225
223
|
it 'has correct authorize params' do
|
226
224
|
subject.client
|
227
225
|
expect(subject.authorize_params[:domain_hint]).to be_nil
|
228
226
|
end
|
229
|
-
|
227
|
+
|
230
228
|
it 'has correct token url' do
|
231
229
|
expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/token')
|
232
230
|
end
|
233
|
-
|
231
|
+
|
234
232
|
it 'has correct token params' do
|
235
233
|
subject.client
|
236
234
|
expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000')
|
237
235
|
end
|
238
|
-
|
236
|
+
|
239
237
|
# todo: how to get this working?
|
240
238
|
# describe "overrides" do
|
241
239
|
# it 'should override domain_hint' do
|
@@ -245,7 +243,7 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
245
243
|
# end
|
246
244
|
# end
|
247
245
|
end
|
248
|
-
|
246
|
+
|
249
247
|
end
|
250
248
|
|
251
249
|
describe 'dynamic common configuration' do
|
@@ -307,4 +305,28 @@ describe OmniAuth::Strategies::AzureOauth2 do
|
|
307
305
|
end.to_not raise_error
|
308
306
|
end
|
309
307
|
end
|
308
|
+
|
309
|
+
describe 'token_params' do
|
310
|
+
let(:strategy) { OmniAuth::Strategies::AzureOauth2.new(app, client_id: 'id', client_secret: 'secret') }
|
311
|
+
let(:request) { double('Request', env: env) }
|
312
|
+
let(:env) { {} }
|
313
|
+
|
314
|
+
subject { strategy.token_params }
|
315
|
+
|
316
|
+
before { allow(strategy).to receive(:request).and_return request }
|
317
|
+
|
318
|
+
it { is_expected.to be_a OmniAuth::Strategy::Options }
|
319
|
+
it 'has default resource' do
|
320
|
+
expect(subject.resource).to eq '00000002-0000-0000-c000-000000000000'
|
321
|
+
end
|
322
|
+
|
323
|
+
context 'when custom crm url' do
|
324
|
+
let(:crm_url) { 'https://mydomain.crm.dynamics.com/' }
|
325
|
+
let(:env) { { 'omniauth.params' => { 'azure_resource' => crm_url } } }
|
326
|
+
|
327
|
+
it 'has resource from url params' do
|
328
|
+
expect(subject.resource).to eq crm_url
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
310
332
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.10
|
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: 2018-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -28,16 +28,22 @@ dependencies:
|
|
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
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3.0'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '1.0'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: omniauth-oauth2
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|