omniauth-entra-id 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +14 -13
- data/UPGRADING.md +3 -1
- data/lib/omniauth/entra_id/version.rb +2 -2
- data/lib/omniauth/strategies/entra_id.rb +33 -15
- data/omniauth-entra-id.gemspec +10 -9
- metadata +26 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddd915751370dcbd9611821ce2e0c853737f92b9a4a3c0751199787dd41af788
|
4
|
+
data.tar.gz: 72b7bde2f8365d41b6c2f8429410df3cd9a2ceb4b7c820cb53ab4626c45b59c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c78e6a6790f3ecdfc8e81381a7873fa7f389d1289ae56666e278ccc965f2fab090ae41de88c7eabcac4d3542f9678e2aee74c70e42dfd7b445fc6d646c459ece
|
7
|
+
data.tar.gz: 32a9a37f322f690b09653db3161c0400c435400b3f8a3670f0e673ca3a83451d42d629f69efd339ee7132bd540aba6cb80b93babf435868a59f1eda8a8aa80f5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## v3.1.0 (2025-06-17)
|
4
|
+
|
5
|
+
* Provides a way to ignore TID when constructing a user UID, easing migration from v2.x, via the new `ignore_tid` option, resolving #42 (reported by @s-andringa)
|
6
|
+
* Handles a missing (`nil`) TID, via #46 (thanks to @frenkel)
|
7
|
+
* Ruby 3.4 "officially" supported through coverage in CI, via #47 (thanks to @hakeem0114)
|
8
|
+
* Supports JWT gem v2.9.x or v3.x, via #48 (thanks to @djpremier)
|
9
|
+
|
3
10
|
## v3.0.1 (2024-11-21)
|
4
11
|
|
5
12
|
* Fixes a minor error in [`UPGRADING.md`](UPGRADING.md) reported in #38, via #40 (thanks to @kennethgeerts)
|
data/README.md
CHANGED
@@ -104,19 +104,20 @@ To have your application authenticate with Entra via a client secret, specify `c
|
|
104
104
|
|
105
105
|
If you're using the client assertion flow, you need to register your certificate in the Entra portal. For more information, please see [the documentation](https://learn.microsoft.com/en-us/entra/identity-platform/certificate-credentials).
|
106
106
|
|
107
|
-
| Option
|
108
|
-
|
|
109
|
-
| `client_id`
|
110
|
-
| `client_secret`
|
111
|
-
| `certificate_path`
|
112
|
-
| `tenant_id`
|
113
|
-
| `base_url`
|
114
|
-
| `tenant_name`
|
115
|
-
| `custom_policy`
|
116
|
-
| `authorize_params`
|
117
|
-
| `domain_hint`
|
118
|
-
| `scope`
|
119
|
-
|
|
107
|
+
| Option | Use |
|
108
|
+
| ----------------------------- | --- |
|
109
|
+
| `client_id` | **Mandatory.** Client ID for the 'application' (integration) configured on the Entra side. Found via the Entra UI. |
|
110
|
+
| `client_secret` | **Mandatory for client secret flow.** Client secret for the 'application' (integration) configured on the Entra side. Found via the Entra UI. Don't give this if using client assertion flow. |
|
111
|
+
| `certificate_path` | **Mandatory for client assertion flow.** Don't give this if using a client secret instead of client assertion. This should be the filepath to a PKCS#12 file. |
|
112
|
+
| `tenant_id` | **Mandatory for client assertion flow.** Entra Tenant ID for multi-tenanted use. Default is `common`. Forms part of the Entra OAuth URL - `{base}/{tenant_id}/oauth2/v2.0/...` |
|
113
|
+
| `base_url` | Location of Entra login page, for specialised requirements; default is `OmniAuth::Strategies::EntraId::BASE_URL` (at the time of writing, this is `https://login.microsoftonline.com`). |
|
114
|
+
| `tenant_name` | For what is currently known by its old name of "Azure ActiveDirectory B2C" (and only active if `custom_policy` is also provided - see below), set the tenancy name to constructs the correct B2C endpoint of `{tenant_name}.b2clogin.com/{tenant_name}.onmicrosoft.com/{custom_policy>}" and uses that for auth calls. This is a convenience feature; the `base_entra_url` option could also be manually built up in the same way. |
|
115
|
+
| `custom_policy` | Custom policy. Default is nil. Used in conjunction with `tenant_name`- see above. |
|
116
|
+
| `authorize_params` | Additional parameters passed as URL query data in the initial OAuth redirection to Microsoft. See below for more. Empty Hash default. |
|
117
|
+
| `domain_hint` | If defined, sets (overwriting, if already present) `domain_hint` inside `authorize_params`. Default `nil` / none. |
|
118
|
+
| `scope` | If defined, sets (overwriting, if already present) `scope` inside `authorize_params`. Default is `OmniAuth::Strategies::EntraId::DEFAULT_SCOPE` (at the time of writing, this is `'openid profile email'`). |
|
119
|
+
| `ìgnore_tid?` or `ignore_tid` | If set to `true`, tenant ID (TID) is *not* included for a user's UID from Entra. Use if you are confident that an Entra OID will be globally unique and have existing OID-only UIDs in use. Default is `false`; both TID and OID are used to form a UID. Note that the option name variation without the question mark only works for directly-specified options; provider classes must always define an override method called `ignore_tid?`. |
|
120
|
+
| `adfs?` or `adfs` | If set to `true`, modifies the URLs so they work with an on-premise AD FS server (Active Directory Federation Services). In order to use this you also need to set the `base_url` correctly and fill the `tenant_id` with `'adfs'`. Note that the option name variation without the question mark only works for directly-specified options; provider classes must always define an override method called `adfs?`. |
|
120
121
|
|
121
122
|
In addition, as a special case, if the request URL contains a query parameter `prompt`, then this will be written into `authorize_params` under that key, overwriting if present any other value there. Note that this comes from the current request URL at the time OAuth flow is commencing, _not_ via static options Hash data or via a custom provider class - but you _could_ just as easily set `scope` inside a custom `authorize_params` returned from a provider class, as shown in an example later; the request URL query mechanism is just another way of doing the same thing.
|
122
123
|
|
data/UPGRADING.md
CHANGED
@@ -73,9 +73,11 @@ This change is for UIDs and is the main reason for creating a V3 gem, whether or
|
|
73
73
|
* The UID returned by OmniAuth for a user previously depended upon the `oid` (object ID) returned by Microsoft. As noted in #33 and fixed in #34, this _might not be unique_ and tenant ID (`tid`) is supposed to be considered too.
|
74
74
|
* Out-of-box, Entra ID will do this. If you were an Azure ActiveDirectory V2 (old-name gem, version 2.x) user, then you will have been receiving different UIDs based only on the `oid` from Microsoft.
|
75
75
|
* **The change of OID might break the connection between a previously-registered and logged in user and a new login** as usually, you need to store the OmniAuth UID somewhere alongside or within your User records when a user is "connected to" an external OAuth service such as Entra ID.
|
76
|
+
* **However, there is a strong argument that TID is not needed** - see https://github.com/pond/omniauth-entra-id/issues/42 for a good argument to that end.
|
76
77
|
|
77
|
-
You have
|
78
|
+
You have three options, should the issue affect you (and it almost certainly will).
|
78
79
|
|
80
|
+
* If you are confident that you still only need the OID, set the `ignore_tid` option to `true` alongside `client_id` and `client_secret` in your OmniAuth Entra ID initialiser or your custom provider class given to that initialiser, if you use one. See the top-level `README.md` for more.
|
79
81
|
* If you can determine the tenant IDs for all users in your database, you can just migrate the UIDs. The new UID is just a simple concatenation of tenant ID and object ID, so treating the UID as a string, add the tenant ID as a prefix without any other changes in your migration and things should work fine thereafter.
|
80
82
|
* Otherwise, you should lazy-migrate:
|
81
83
|
- As usual, in your OAuth callback handler, `request.env['omniauth.auth'].uid` gives the UID - but now that's the "new" Entra gem's value which includes tenant ID.
|
@@ -9,14 +9,15 @@ module OmniAuth
|
|
9
9
|
|
10
10
|
option :name, 'entra_id'
|
11
11
|
option :tenant_provider, nil
|
12
|
+
option :ignore_tid, false
|
12
13
|
option :jwt_leeway, 60
|
13
14
|
|
14
15
|
DEFAULT_SCOPE = 'openid profile email'
|
15
16
|
COMMON_TENANT_ID = 'common'
|
16
17
|
AD_FS_TENANT_ID = 'adfs'
|
17
18
|
|
18
|
-
# The tenant_provider
|
19
|
-
#
|
19
|
+
# The tenant_provider argument is how the provider class is eventually
|
20
|
+
# passed to us, if one is used instead of an options Hash.
|
20
21
|
#
|
21
22
|
args [:tenant_provider]
|
22
23
|
|
@@ -58,6 +59,7 @@ module OmniAuth
|
|
58
59
|
options.custom_policy = provider.custom_policy if provider.respond_to?(:custom_policy)
|
59
60
|
options.authorize_params = provider.authorize_params if provider.respond_to?(:authorize_params)
|
60
61
|
options.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint
|
62
|
+
options.ignore_tid = provider.ignore_tid? if provider.respond_to?(:ignore_tid?) && provider.ignore_tid?
|
61
63
|
options.authorize_params.prompt = request.params['prompt'] if defined?(request) && request.params['prompt']
|
62
64
|
|
63
65
|
options.authorize_params.scope = if defined?(request) && request.params['scope']
|
@@ -88,14 +90,32 @@ module OmniAuth
|
|
88
90
|
|
89
91
|
uid do
|
90
92
|
#
|
91
|
-
#
|
93
|
+
# Note 1:
|
94
|
+
#
|
95
|
+
# https://learn.microsoft.com/en-us/entra/identity-platform/migrate-off-email-claim-authorization
|
92
96
|
#
|
93
97
|
# OID alone might not be unique; TID must be included. An alternative
|
94
98
|
# would be to use 'sub' but this is only unique in client/app
|
95
99
|
# registration context. If a different app registration is used, the
|
96
|
-
# 'sub' values can be different too
|
100
|
+
# 'sub' values can be different too...
|
101
|
+
#
|
102
|
+
# Note 2:
|
103
|
+
#
|
104
|
+
# https://github.com/pond/omniauth-entra-id/issues/42
|
105
|
+
#
|
106
|
+
# ...but not everyone agrees on the necessity of a TID and if migrating
|
107
|
+
# from an earlier version of this gem where user data already includes
|
108
|
+
# OID-only identifiers, you might elect to avoid a difficult migration
|
109
|
+
# by opting out - set the "ignore_tid" option to 'true'.
|
110
|
+
#
|
111
|
+
# NB: If the TID is missing or blank the UID uses only the OID, just as
|
112
|
+
# if the "ignore_tid" option were set.
|
97
113
|
#
|
98
|
-
|
114
|
+
if options.ignore_tid? || raw_info['tid'].nil?
|
115
|
+
raw_info['oid']
|
116
|
+
else
|
117
|
+
raw_info['tid'] + raw_info['oid']
|
118
|
+
end
|
99
119
|
end
|
100
120
|
|
101
121
|
info do
|
@@ -154,16 +174,14 @@ module OmniAuth
|
|
154
174
|
|
155
175
|
# https://learn.microsoft.com/en-us/entra/identity-platform/id-tokens#validate-tokens
|
156
176
|
#
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
leeway: options[:jwt_leeway]
|
166
|
-
)
|
177
|
+
verify_params = {
|
178
|
+
aud: options.client_id,
|
179
|
+
exp: { leeway: options.jwt_leeway },
|
180
|
+
nbf: { leeway: options.jwt_leeway }
|
181
|
+
}
|
182
|
+
verify_params[:iss] = issuer unless issuer.nil?
|
183
|
+
|
184
|
+
::JWT::Claims.verify_payload!(id_token_data, verify_params)
|
167
185
|
|
168
186
|
auth_token_data = begin
|
169
187
|
::JWT.decode(access_token.token, nil, false).first
|
data/omniauth-entra-id.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.authors = [ 'RIPA Global' ]
|
15
15
|
s.email = [ 'dev@ripaglobal.com' ]
|
16
16
|
s.licenses = [ 'MIT' ]
|
17
|
-
s.homepage = 'https://github.com/
|
17
|
+
s.homepage = 'https://github.com/pond/scimitar/'
|
18
18
|
|
19
19
|
s.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
|
20
20
|
s.require_paths = ['lib']
|
@@ -39,15 +39,16 @@ Gem::Specification.new do |s|
|
|
39
39
|
}
|
40
40
|
|
41
41
|
s.metadata = {
|
42
|
-
'homepage_uri' =>
|
43
|
-
'bug_tracker_uri' => 'https://github.com/
|
44
|
-
'changelog_uri' => 'https://github.com/
|
45
|
-
'source_code_uri' => 'https://github.com/
|
42
|
+
'homepage_uri' => s.homepage,
|
43
|
+
'bug_tracker_uri' => 'https://github.com/pond/omniauth-entra-id/issues/',
|
44
|
+
'changelog_uri' => 'https://github.com/pond/omniauth-entra-id/blob/master/CHANGELOG.md',
|
45
|
+
'source_code_uri' => 'https://github.com/pond/omniauth-entra-id'
|
46
46
|
}
|
47
47
|
|
48
|
-
s.add_runtime_dependency
|
48
|
+
s.add_runtime_dependency 'jwt', '>= 2.9.2'
|
49
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.8'
|
49
50
|
|
50
|
-
s.add_development_dependency
|
51
|
-
s.add_development_dependency
|
52
|
-
s.add_development_dependency
|
51
|
+
s.add_development_dependency 'debug', '~> 1.10'
|
52
|
+
s.add_development_dependency 'rake', '~> 13.3'
|
53
|
+
s.add_development_dependency 'rspec', '~> 3.13'
|
53
54
|
end
|
metadata
CHANGED
@@ -1,15 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-entra-id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RIPA Global
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-06-17 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: jwt
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 2.9.2
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 2.9.2
|
13
26
|
- !ruby/object:Gem::Dependency
|
14
27
|
name: omniauth-oauth2
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -30,28 +43,28 @@ dependencies:
|
|
30
43
|
requirements:
|
31
44
|
- - "~>"
|
32
45
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
46
|
+
version: '1.10'
|
34
47
|
type: :development
|
35
48
|
prerelease: false
|
36
49
|
version_requirements: !ruby/object:Gem::Requirement
|
37
50
|
requirements:
|
38
51
|
- - "~>"
|
39
52
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
53
|
+
version: '1.10'
|
41
54
|
- !ruby/object:Gem::Dependency
|
42
55
|
name: rake
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
44
57
|
requirements:
|
45
58
|
- - "~>"
|
46
59
|
- !ruby/object:Gem::Version
|
47
|
-
version: '13.
|
60
|
+
version: '13.3'
|
48
61
|
type: :development
|
49
62
|
prerelease: false
|
50
63
|
version_requirements: !ruby/object:Gem::Requirement
|
51
64
|
requirements:
|
52
65
|
- - "~>"
|
53
66
|
- !ruby/object:Gem::Version
|
54
|
-
version: '13.
|
67
|
+
version: '13.3'
|
55
68
|
- !ruby/object:Gem::Dependency
|
56
69
|
name: rspec
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +79,6 @@ dependencies:
|
|
66
79
|
- - "~>"
|
67
80
|
- !ruby/object:Gem::Version
|
68
81
|
version: '3.13'
|
69
|
-
description:
|
70
82
|
email:
|
71
83
|
- dev@ripaglobal.com
|
72
84
|
executables: []
|
@@ -86,15 +98,14 @@ files:
|
|
86
98
|
- lib/omniauth/entra_id/version.rb
|
87
99
|
- lib/omniauth/strategies/entra_id.rb
|
88
100
|
- omniauth-entra-id.gemspec
|
89
|
-
homepage: https://github.com/
|
101
|
+
homepage: https://github.com/pond/scimitar/
|
90
102
|
licenses:
|
91
103
|
- MIT
|
92
104
|
metadata:
|
93
|
-
homepage_uri: https://
|
94
|
-
bug_tracker_uri: https://github.com/
|
95
|
-
changelog_uri: https://github.com/
|
96
|
-
source_code_uri: https://github.com/
|
97
|
-
post_install_message:
|
105
|
+
homepage_uri: https://github.com/pond/scimitar/
|
106
|
+
bug_tracker_uri: https://github.com/pond/omniauth-entra-id/issues/
|
107
|
+
changelog_uri: https://github.com/pond/omniauth-entra-id/blob/master/CHANGELOG.md
|
108
|
+
source_code_uri: https://github.com/pond/omniauth-entra-id
|
98
109
|
rdoc_options: []
|
99
110
|
require_paths:
|
100
111
|
- lib
|
@@ -109,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
120
|
- !ruby/object:Gem::Version
|
110
121
|
version: '0'
|
111
122
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
123
|
+
rubygems_version: 3.6.2
|
114
124
|
specification_version: 4
|
115
125
|
summary: OAuth 2 authentication with the Entra ID API.
|
116
126
|
test_files: []
|