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: 1709f398346ffb52d4477645cc2d7fd289490a4d
4
- data.tar.gz: f7d8ab0dc27ba6ab11947611f46e5aef48a2658d
3
+ metadata.gz: fd622f841b717635405a31b2ca3817b2e5eef5e1
4
+ data.tar.gz: 57bb2bf5a24c69db93c36563576593fade0ac646
5
5
  SHA512:
6
- metadata.gz: 52dd89caac47c6ec88794c0b96d7bc0da6f1194890b7a92e6027ccae9ebd39af7f06502ce67f1662ef418c616bb181a63a97c53b0de7f07f7d0d21b2d5e26448
7
- data.tar.gz: dc8289cbe82684efaa699f3a4bad02f12989f80fb939f398a816567bee1c3dea1eae73df20206da8aa30cde08e52b274cbc7d0a5f2ed1aa8aad28ec57c7f4ce5
6
+ metadata.gz: e059ee9e2289c6949b368bc8cf14c45b0f0eb85fa1da5cf477b4b742e465b58922b3f7336013e80849c3c037d63680cbd5318458c64cf5370650d81d2ca08f8b
7
+ data.tar.gz: 095233d9948ed4bc1bee1a8b93d9a869ab34e5a688e85c3edff14f96bc688baa12e29059abf6541d9817e5beda7a4a8b81a2730178a630c57f12c7185725f09d
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module MicrosoftOffice365
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -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 :authorize_params, {
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.6
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-04-21 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth