omniauth-microsoft_graph 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of omniauth-microsoft_graph might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66a0ea4d256b036a576000cd3de91de39bfc45a0
4
- data.tar.gz: ce2a59256d5db7b62f751a32b16e730bf1f940d6
3
+ metadata.gz: cdecd030ef703f1a67b5ee1a0cb818c522e62caa
4
+ data.tar.gz: fe2acbe7d3c926ebe96d1836f381d9861cd553e3
5
5
  SHA512:
6
- metadata.gz: 969345446695fcceaded706cd2afbc5fb27ea9f1b63596d8942865cdaedbb63fd5ac9c23f6779c68ca7e5b0120e1bcf7949ac6e9f81c943d207934566de4e5bd
7
- data.tar.gz: 92e18899eb92fac4f3249a0e4732ca378071a0564d0810ff0c180ce9a5abaa623038e256c96870fd6084a449e1ae7355b576979bdee539fb3f413c94d7231f50
6
+ metadata.gz: 1dbfaaa74ed47f1982ee67990dcaa422e8ab7c5ecd5e6f8f5209432b748ed922906a0458be0c554404f1b1dc37128c06493760ac5438b747f1587fd0559bc00d
7
+ data.tar.gz: 0d754b53cc811ab543c6efc57776ee2ad0e471dbc57b194dc4fcc82c3c1a1c2aeab18e4df5c6e7a843a1807b7f3781e68c8f5bed4385a974abf80e6f8e02ef8a
data/example/example.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  $:.push File.dirname(__FILE__) + '/../lib'
2
2
 
3
- require 'omniauth-microsoft_graph'
3
+ require 'microsoft_graph'
4
4
  require 'sinatra'
5
5
  require 'json'
6
6
 
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
- module Office365
3
- VERSION = "0.1.0"
2
+ module MicrosoftGraph
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -6,28 +6,22 @@ module OmniAuth
6
6
  option :name, :microsoft_graph
7
7
 
8
8
  option :client_options, {
9
- site: 'https://login.microsoftonline.com/common/oauth2/authorize',
10
- token_url: 'https://login.microsoftonline.com/common/oauth2/token',
11
- authorize_url: 'https://login.microsoftonline.com/common/oauth2/authorize'
9
+ site: 'https://login.microsoftonline.com',
10
+ token_url: '/common/oauth2/v2.0/token',
11
+ authorize_url: '/common/oauth2/v2.0/authorize'
12
12
  }
13
13
 
14
- option :authorize_params, {
15
- resource: 'https://graph.microsoft.com/'
16
- }
17
-
18
- option :token_params, {
19
- resource: 'https://graph.microsoft.com/'
20
- }
14
+ option :authorize_options, %i[display score auth_type scope prompt login_hint domain_hint response_mode]
21
15
 
22
16
  uid { raw_info["id"] }
23
17
 
24
18
  info do
25
19
  {
26
- 'email' => raw_info["mail"],
27
- 'first_name' => raw_info["givenName"],
28
- 'last_name' => raw_info["surname"],
29
- 'name' => [raw_info["givenName"], raw_info["surname"]].join(' '),
30
- 'nickname' => raw_info["displayName"],
20
+ email: raw_info["mail"] || raw_info["userPrincipalName"],
21
+ first_name: raw_info["givenName"],
22
+ last_name: raw_info["surname"],
23
+ name: full_name,
24
+ nickname: raw_info["userPrincipalName"],
31
25
  }
32
26
  end
33
27
 
@@ -37,9 +31,27 @@ module OmniAuth
37
31
  'params' => access_token.params
38
32
  }
39
33
  end
34
+
35
+ def callback_url
36
+ options[:redirect_uri] || (full_host + script_name + callback_path)
37
+ end
40
38
 
41
39
  def raw_info
42
- @raw_info ||= access_token.get(authorize_params.resource + 'v1.0/me').parsed
40
+ @raw_info ||= access_token.get('https://graph.microsoft.com/v1.0/me').parsed
41
+ end
42
+
43
+ def authorize_params
44
+ super.tap do |params|
45
+ %w[display score auth_type].each do |v|
46
+ if request.params[v]
47
+ params[v.to_sym] = request.params[v]
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ def full_name
54
+ raw_info["displayName"].presence || raw_info.values_at("givenName", "surname").compact.join(' ')
43
55
  end
44
56
  end
45
57
  end
@@ -5,9 +5,9 @@ require 'omniauth/microsoft_graph/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "omniauth-microsoft_graph"
8
- spec.version = Omniauth::Office365::VERSION
9
- spec.authors = ["Peter Philips"]
10
- spec.email = ["pete@p373.net"]
8
+ spec.version = Omniauth::MicrosoftGraph::VERSION
9
+ spec.authors = ["Peter Philips", "Joel Van Horn"]
10
+ spec.email = ["pete@p373.net", "joel@joelvanhorn.com"]
11
11
  spec.summary = %q{omniauth provider for Microsoft Graph}
12
12
  spec.description = %q{omniauth provider for new Microsoft Graph API}
13
13
  spec.homepage = "https://github.com/synth/omniauth-microsoft_graph"
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-microsoft_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Philips
8
+ - Joel Van Horn
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-06-18 00:00:00.000000000 Z
12
+ date: 2018-08-02 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: omniauth-oauth2
@@ -83,6 +84,7 @@ dependencies:
83
84
  description: omniauth provider for new Microsoft Graph API
84
85
  email:
85
86
  - pete@p373.net
87
+ - joel@joelvanhorn.com
86
88
  executables: []
87
89
  extensions: []
88
90
  extra_rdoc_files: []