omniauth-azure-activedirectory-v2 0.1.1 → 2.0.0

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
  SHA256:
3
- metadata.gz: 80a76c16a7b809e84e27846806c3f8aa685ef765f7abc836006d17b602223a28
4
- data.tar.gz: 1c6d60e594ee6002bfdf958c5d6db5a14f4f3dec4f76d71cd0ed65df1cbbfb10
3
+ metadata.gz: 6292ee8af704acb7005d47fa78c9ebae4ae9e49bc677dcaff08e087560004013
4
+ data.tar.gz: 418effa55080e12e2371804f2634c67977c782c7fa9a4bbb3fafbae253e69307
5
5
  SHA512:
6
- metadata.gz: 125ae35a66c2a79a19cca02e628d0e825d4835ff2e82d74ba2f9da604eb80edd58bb8119ff4bab51a76be1240b8646155c2c89e33d0f3f34486dcbfce9cf7347
7
- data.tar.gz: cdf8f67104262494e48d50ed872a30bc6963c0ebbb8ebbd4c251d9b0ea50133bd897bf3a417ab4c0eaff5e3ad63ac4b7812de07599ff6c1bf425871f7a2b4686
6
+ metadata.gz: 89d6e827e31cb60be2c30fbc464360bc355b0381ec653874535125da81fa596e7c2ec43134183417c8ff29ce631737e0ce2bb79ff1876354a67a45fd1eccbef6
7
+ data.tar.gz: 5e551b04a716d10745cd913af183ba1997c705f16edb39e925c2cdff59b4905a39b113c333fa2f1b927179eef58383be150c6012f31627e5f14776830f6dacf5
data/CHANGELOG.md ADDED
@@ -0,0 +1,34 @@
1
+ # Change Log
2
+
3
+ ## v2.0.0 (2022-09-14)
4
+
5
+ Makes compatible with OmniAuth 2 and requires it.
6
+
7
+ Note: https://github.com/RIPAGlobal/omniauth-azure-activedirectory-v2/pull/6 for reasoning - Thanks @jessieay
8
+
9
+ _Major version bump as no longer supports Omniauth 1._
10
+
11
+ ## v1.0.0 (2020-09-25)
12
+
13
+ Removes use of the https://graph.microsoft.com/v1.0/me API.
14
+
15
+ * One of the key differences for the V2 API vs V1 is the differences
16
+ between who can sign with the addition of Personal Accounts - see:
17
+ https://nicolgit.github.io/AzureAD-Endopoint-V1-vs-V2-comparison/
18
+
19
+ - In testing we found that these accounts may not have access to
20
+ this endpoint
21
+ - All the data provided in `info` exists in the JWT anyway, so this
22
+ cuts down on API calls
23
+
24
+ * Conforms to the Omniauth Auth Hash Schema (1.0 and later) - see:
25
+ https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema
26
+
27
+ - Expose `raw_info`
28
+ - Remove `id` from `info`
29
+ - *NB: This could be a breaking change for some, but most will
30
+ already be using the correct property name of `uid`.*
31
+
32
+ ## v0.1.1 (2020-09-23)
33
+
34
+ - First release.
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at jesse.whitham@gmail.com. All
58
+ reported by contacting the project team at dev@ripglobal.com. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # Omniauth::Azure::Activedirectory::V2
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/omniauth-azure-activedirectory-v2.svg)](https://badge.fury.io/rb/omniauth-azure-activedirectory-v2)
4
+ [![Build Status](https://travis-ci.org/RIPGlobal/omniauth-azure-activedirectory-v2.svg)](https://travis-ci.org/RIPGlobal/omniauth-azure-activedirectory-v2)
5
+ [![License](https://img.shields.io/github/license/RIPGlobal/omniauth-azure-activedirectory-v2.svg)](LICENSE.md)
6
+
3
7
  OAuth 2 authentication with [Azure ActiveDirectory's V2 API](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-overview). Rationale:
4
8
 
5
9
  * https://github.com/marknadig/omniauth-azure-oauth2 is no longer maintained.
6
10
  * https://github.com/marknadig/omniauth-azure-oauth2/pull/29 contains important additions.
7
11
 
8
- This gem combines the two.
12
+ This gem combines the two and makes some changes to support the full V2 API.
9
13
 
10
14
  The ActiveDirectory V1 auth API used OpenID Connect. If you need this, a gem from Microsoft [is available here](https://github.com/AzureAD/omniauth-azure-activedirectory), but seems to be abandoned.
11
15
 
@@ -37,7 +41,7 @@ See https://github.com/marknadig/omniauth-azure-oauth2 for background informatio
37
41
 
38
42
  ## Contributing
39
43
 
40
- Bug reports and pull requests are welcome on GitHub at https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2. This project is intended to be a safe, welcoming space for collaboration so contributors must adhere to the [code of conduct](https://github.com/[USERNAME]/omniauth-azure-activedirectory-v2/blob/master/CODE_OF_CONDUCT.md).
44
+ Bug reports and pull requests are welcome on GitHub at https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2. This project is intended to be a safe, welcoming space for collaboration so contributors must adhere to the [code of conduct](https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/blob/master/CODE_OF_CONDUCT.md).
41
45
 
42
46
 
43
47
 
@@ -49,4 +53,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
49
53
 
50
54
  ## Code of Conduct
51
55
 
52
- Everyone interacting in this project's codebases, issue trackers, chat rooms and mailing lists must follow the [code of conduct](https://github.com/[USERNAME]/omniauth-azure-activedirectory-v2/blob/master/CODE_OF_CONDUCT.md).
56
+ Everyone interacting in this project's codebases, issue trackers, chat rooms and mailing lists must follow the [code of conduct](https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/blob/master/CODE_OF_CONDUCT.md).
@@ -2,7 +2,8 @@ module Omniauth
2
2
  module Azure
3
3
  module Activedirectory
4
4
  module V2
5
- VERSION = "0.1.1"
5
+ VERSION = "2.0.0"
6
+ DATE = "2022-09-14"
6
7
  end
7
8
  end
8
9
  end
@@ -9,7 +9,6 @@ module OmniAuth
9
9
  option :tenant_provider, nil
10
10
 
11
11
  DEFAULT_SCOPE = 'openid profile email'
12
- USER_INFO_URL = 'https://graph.microsoft.com/v1.0/me'
13
12
 
14
13
  # tenant_provider must return client_id, client_secret and optionally tenant_id and base_azure_url
15
14
  args [:tenant_provider]
@@ -40,27 +39,49 @@ module OmniAuth
40
39
  end
41
40
 
42
41
  uid {
43
- raw_info['id']
42
+ raw_info['oid']
44
43
  }
45
44
 
46
45
  info do
47
46
  {
48
- name: raw_info['displayName'],
49
- first_name: raw_info['givenName'],
50
- last_name: raw_info['surname'],
51
- email: raw_info['userPrincipalName'],
52
- id: raw_info['id'],
47
+ name: raw_info['name'],
48
+ email: raw_info['email'] || raw_info['upn'],
49
+ nickname: raw_info['unique_name'],
50
+ first_name: raw_info['given_name'],
51
+ last_name: raw_info['family_name']
53
52
  }
54
53
  end
55
54
 
55
+ extra do
56
+ { raw_info: raw_info }
57
+ end
58
+
56
59
  def callback_url
57
- full_host + script_name + callback_path
60
+ full_host + callback_path
58
61
  end
59
62
 
63
+ # https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens
64
+ #
65
+ # Some account types from Microsoft seem to only have a decodable ID token,
66
+ # with JWT unable to decode the access token. Information is limited in those
67
+ # cases. Other account types provide an expanded set of data inside the auth
68
+ # token, which does decode as a JWT.
69
+ #
70
+ # Merge the two, allowing the expanded auth token data to overwrite the ID
71
+ # token data if keys collide, and use this as raw info.
72
+ #
60
73
  def raw_info
61
- @raw_info ||= access_token.get(USER_INFO_URL).parsed
74
+ if @raw_info.nil?
75
+ id_token_data = ::JWT.decode(access_token.params['id_token'], nil, false).first rescue {}
76
+ auth_token_data = ::JWT.decode(access_token.token, nil, false).first rescue {}
77
+
78
+ id_token_data.merge!(auth_token_data)
79
+ @raw_info = id_token_data
80
+ end
81
+
82
+ @raw_info
62
83
  end
63
84
 
64
85
  end
65
86
  end
66
- end
87
+ end
@@ -1,29 +1,49 @@
1
- require_relative 'lib/omniauth/azure_activedirectory_v2/version'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'omniauth-azure-activedirectory-v2'
5
- spec.version = Omniauth::Azure::Activedirectory::V2::VERSION
6
- spec.authors = ['RIP Global']
7
- spec.email = ['dev@ripglobal.com']
8
-
9
- spec.summary = %q{OAuth 2 authentication with Azure ActiveDirectory's V2 API}
10
- spec.homepage = 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2'
11
- spec.license = 'MIT'
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
-
14
- spec.metadata['homepage_uri'] = spec.homepage
15
- spec.metadata['source_code_uri'] = 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2'
16
- spec.metadata['bug_tracker_uri'] = 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/issues/'
17
- spec.metadata['changelog_uri'] = 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/blob/master/CHANGELOG.md'
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
24
- spec.bindir = 'exe'
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ['lib']
27
-
28
- spec.add_dependency 'omniauth-oauth2'
1
+ # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+ # stub: omniauth-azure-activedirectory-v2 1.0.0 ruby lib
4
+
5
+ $:.push File.expand_path( '../lib', __FILE__ )
6
+ require 'omniauth/azure_activedirectory_v2/version'
7
+
8
+ # https://guides.rubygems.org/specification-reference/
9
+ #
10
+ Gem::Specification.new do |s|
11
+ s.name = 'omniauth-azure-activedirectory-v2'
12
+ s.version = Omniauth::Azure::Activedirectory::V2::VERSION
13
+ s.date = Omniauth::Azure::Activedirectory::V2::DATE
14
+ s.summary = 'OAuth 2 authentication with the Azure ActiveDirectory V2 API.'
15
+ s.authors = [ 'RIP Global' ]
16
+ s.email = [ 'dev@ripglobal.com' ]
17
+ s.licenses = [ 'MIT' ]
18
+ s.homepage = 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2'
19
+
20
+ s.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
21
+ s.require_paths = ['lib']
22
+ s.bindir = 'exe'
23
+ s.files = %w{
24
+ README.md
25
+ CHANGELOG.md
26
+ CODE_OF_CONDUCT.md
27
+ LICENSE.txt
28
+
29
+ Gemfile
30
+ bin/console
31
+ bin/setup
32
+
33
+ lib/omniauth-azure-activedirectory-v2.rb
34
+ lib/omniauth/azure_activedirectory_v2.rb
35
+ lib/omniauth/azure_activedirectory_v2/version.rb
36
+ lib/omniauth/strategies/azure_activedirectory_v2.rb
37
+
38
+ omniauth-azure-activedirectory-v2.gemspec
39
+ }
40
+
41
+ s.metadata = {
42
+ 'homepage_uri' => 'https://www.ripglobal.com/',
43
+ 'bug_tracker_uri' => 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/issues/',
44
+ 'changelog_uri' => 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/blob/master/CHANGELOG.md',
45
+ 'source_code_uri' => 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2'
46
+ }
47
+
48
+ s.add_runtime_dependency('omniauth-oauth2', '~> 1.8')
29
49
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-azure-activedirectory-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RIP Global
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2022-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.8'
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
- version: '0'
26
+ version: '1.8'
27
27
  description:
28
28
  email:
29
29
  - dev@ripglobal.com
@@ -31,14 +31,11 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - ".gitignore"
35
- - ".rspec"
36
- - ".travis.yml"
34
+ - CHANGELOG.md
37
35
  - CODE_OF_CONDUCT.md
38
36
  - Gemfile
39
37
  - LICENSE.txt
40
38
  - README.md
41
- - Rakefile
42
39
  - bin/console
43
40
  - bin/setup
44
41
  - lib/omniauth-azure-activedirectory-v2.rb
@@ -50,10 +47,10 @@ homepage: https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2
50
47
  licenses:
51
48
  - MIT
52
49
  metadata:
53
- homepage_uri: https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2
54
- source_code_uri: https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2
50
+ homepage_uri: https://www.ripglobal.com/
55
51
  bug_tracker_uri: https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/issues/
56
52
  changelog_uri: https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2/blob/master/CHANGELOG.md
53
+ source_code_uri: https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2
57
54
  post_install_message:
58
55
  rdoc_options: []
59
56
  require_paths:
@@ -69,8 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
66
  - !ruby/object:Gem::Version
70
67
  version: '0'
71
68
  requirements: []
72
- rubygems_version: 3.1.2
69
+ rubygems_version: 3.3.7
73
70
  signing_key:
74
71
  specification_version: 4
75
- summary: OAuth 2 authentication with Azure ActiveDirectory's V2 API
72
+ summary: OAuth 2 authentication with the Azure ActiveDirectory V2 API.
76
73
  test_files: []
data/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- Gemfile.lock
2
-
3
- /.bundle/
4
- /.yardoc
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
11
-
12
- # rspec failure tracking
13
- .rspec_status
14
-
15
- # ide
16
- .idea
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.0
6
- before_install: gem install bundler -v 2.1.2
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec