omniauth-microsoft-office365 0.0.6 → 0.0.7
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: fd622f841b717635405a31b2ca3817b2e5eef5e1
|
4
|
+
data.tar.gz: 57bb2bf5a24c69db93c36563576593fade0ac646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e059ee9e2289c6949b368bc8cf14c45b0f0eb85fa1da5cf477b4b742e465b58922b3f7336013e80849c3c037d63680cbd5318458c64cf5370650d81d2ca08f8b
|
7
|
+
data.tar.gz: 095233d9948ed4bc1bee1a8b93d9a869ab34e5a688e85c3edff14f96bc688baa12e29059abf6541d9817e5beda7a4a8b81a2730178a630c57f12c7185725f09d
|
@@ -5,15 +5,15 @@ module OmniAuth
|
|
5
5
|
class MicrosoftOffice365 < OmniAuth::Strategies::OAuth2
|
6
6
|
option :name, :microsoft_office365
|
7
7
|
|
8
|
+
DEFAULT_SCOPE="openid email profile https://outlook.office.com/contacts.read"
|
9
|
+
|
8
10
|
option :client_options, {
|
9
11
|
site: "https://login.microsoftonline.com",
|
10
12
|
authorize_url: "/common/oauth2/v2.0/authorize",
|
11
13
|
token_url: "/common/oauth2/v2.0/token"
|
12
14
|
}
|
13
15
|
|
14
|
-
option :
|
15
|
-
scope: "openid email profile https://outlook.office.com/contacts.read",
|
16
|
-
}
|
16
|
+
option :authorize_options, [:scope]
|
17
17
|
|
18
18
|
uid { raw_info["Id"] }
|
19
19
|
|
@@ -38,6 +38,18 @@ module OmniAuth
|
|
38
38
|
@raw_info ||= access_token.get("https://outlook.office.com/api/v2.0/me/").parsed
|
39
39
|
end
|
40
40
|
|
41
|
+
def authorize_params
|
42
|
+
super.tap do |params|
|
43
|
+
%w[display scope auth_type].each do |v|
|
44
|
+
if request.params[v]
|
45
|
+
params[v.to_sym] = request.params[v]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
params[:scope] ||= DEFAULT_SCOPE
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
41
53
|
private
|
42
54
|
|
43
55
|
def first_last_from_display_name(display_name)
|
@@ -133,7 +133,7 @@ RSpec.describe OmniAuth::Strategies::MicrosoftOffice365 do
|
|
133
133
|
|
134
134
|
context "when the name is in alternate format" do
|
135
135
|
let(:avatar_response) { instance_double(OAuth2::Response, content_type: "image/jpeg", body: "JPEG_STREAM") }
|
136
|
-
|
136
|
+
|
137
137
|
before do
|
138
138
|
expect(access_token).to receive(:get).with("https://outlook.office.com/api/v2.0/me/photo/$value")
|
139
139
|
.and_return(avatar_response)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-microsoft-office365
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Urbański
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|