lex-identity-entra 0.5.3 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85cdc120eb3f0b5d4d17c8e5a946cc6597ad05c4281f6b058a3782f9a868c139
4
- data.tar.gz: 8f74ba8695ef29922d7a058453b7ca1726c458bd5630db3ac9ed0e921185afb8
3
+ metadata.gz: a50147c3bd7a673e611e5191168b9ade2fe468041ad2b320fccba89dc267a999
4
+ data.tar.gz: a0889be0de3da89dedae7360058f0463ae8570a735b5f759750f74bf0e720974
5
5
  SHA512:
6
- metadata.gz: cedb8ba0c30d800b9ec234d10fe40a67cacfcf21e320786cdb735ee6025cf23b59d90dc115a05d60ee32cf61791c46cf3328e5b00c4387602715419799659361
7
- data.tar.gz: cb74ced2592eb80c0d3bf06576798d44c9531af4fcac3c4215926a0e018c6c2f6d892987149792692a9b53e1c700572f2c9c7a1456e6d2e5075e933ea23799a2
6
+ metadata.gz: bf3ff78771dc93dea6cb326c1577d6421382575e714eb4ef25ae67ca07cbeceab37f5b616dd9a611eea85e3ff31d868964878f85409ced0e8688510d3231e8d8
7
+ data.tar.gz: 74f7b159ecc89ba0e306273e3e6438b81d8cb1ad09c52d5e2f9c1fb1d6cf4de95e06de62317c8253c8a69b9bfd9cb365ca5785ffede017d0e365dfbfd9502e61
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.4] - 2026-08-04
4
+ ### Fixed
5
+ - Stop writing delegated Entra tokens to bootstrap Vault paths. Token persistence now uses only the canonical `users/<identity>/entra/<qualifier>/auth` Vault path and falls back to local disk until a canonical identity is available.
6
+
3
7
  ## [0.5.3] - 2026-07-15
4
8
  ### Fixed
5
9
  - Fix token refresh dead-end: refresh when token exists regardless of authenticated? state
@@ -89,13 +89,9 @@ module Legion
89
89
  end
90
90
 
91
91
  def from_vault_data(qualifier)
92
- return nil unless vault_available?
92
+ return nil unless vault_available? && canonical_name_available?
93
93
 
94
- # Prefer the canonical (post-resolution) path, then fall back to the
95
- # bootstrap path so a fresh process can recover a Vault-only token
96
- # before Legion::Identity::Process is resolved (issue #4).
97
- read_vault_token(qualifier, vault_path(qualifier)) ||
98
- read_vault_token(qualifier, bootstrap_vault_path(qualifier))
94
+ read_vault_token(qualifier, vault_path(qualifier))
99
95
  end
100
96
 
101
97
  def read_vault_token(qualifier, path)
@@ -125,26 +121,21 @@ module Legion
125
121
  def save_to_vault(qualifier, access_token:, refresh_token:, expires_at:,
126
122
  scopes: nil, tenant_id: nil, client_id: nil, scope_fingerprint: nil)
127
123
  return unless vault_available?
124
+ return unless canonical_name_available?
128
125
 
129
- # When canonical identity is resolved, write the canonical key (and
130
- # alias to the bootstrap key so a later fresh process can recover it
131
- # before resolution). Before resolution, fall back to the bootstrap
132
- # key so we never write to a placeholder (anonymous) canonical path.
133
- paths = [vault_path(qualifier), bootstrap_vault_path(qualifier)].compact.uniq
134
- return if paths.empty?
126
+ path = vault_path(qualifier)
127
+ return unless path
135
128
 
136
129
  cluster = Legion::Crypt.respond_to?(:default_cluster_name) ? Legion::Crypt.default_cluster_name : 'vault'
137
- paths.each do |path|
138
- log.info("TokenManager.save_to_vault: writing to #{cluster} :: kv/data/#{path} qualifier=#{qualifier}")
139
- vault_kv_client.write(path,
140
- access_token: access_token,
141
- refresh_token: refresh_token,
142
- expires_at: expires_at&.utc&.iso8601,
143
- scopes: scopes,
144
- tenant_id: tenant_id,
145
- client_id: client_id,
146
- scope_fingerprint: scope_fingerprint)
147
- end
130
+ log.info("TokenManager.save_to_vault: writing to #{cluster} :: kv/data/#{path} qualifier=#{qualifier}")
131
+ vault_kv_client.write(path,
132
+ access_token: access_token,
133
+ refresh_token: refresh_token,
134
+ expires_at: expires_at&.utc&.iso8601,
135
+ scopes: scopes,
136
+ tenant_id: tenant_id,
137
+ client_id: client_id,
138
+ scope_fingerprint: scope_fingerprint)
148
139
  log.info('TokenManager.save_to_vault: success')
149
140
  true
150
141
  rescue StandardError => e
@@ -305,26 +296,6 @@ module Legion
305
296
  "users/#{Legion::Identity::Process.canonical_name}/entra/#{qualifier}/auth"
306
297
  end
307
298
 
308
- # Pre-resolution Vault key for delegated tokens, derived from stable
309
- # inputs (tenant id + client id) that are available before canonical
310
- # identity resolution. Lets a fresh process recover a Vault-only
311
- # delegated token so it can resolve identity (issue #4). Scoped to
312
- # delegated only — other patterns are unaffected.
313
- def bootstrap_vault_path(qualifier)
314
- return nil unless qualifier.to_sym == :delegated
315
-
316
- auth = settings_auth
317
- pattern_settings = auth[qualifier.to_sym]
318
- return pattern_settings[:vault_path] if pattern_settings.is_a?(Hash) && pattern_settings[:vault_path]
319
-
320
- tenant_id = auth[:tenant_id]
321
- client_id = auth[:client_id]
322
- return nil unless tenant_id && client_id
323
-
324
- account = Digest::MD5.hexdigest("#{tenant_id}:#{client_id}")
325
- "bootstrap/entra/#{qualifier}/#{account}/auth"
326
- end
327
-
328
299
  def local_path(qualifier)
329
300
  auth = settings_auth
330
301
  pattern_settings = auth[qualifier.to_sym]
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Identity
6
6
  module Entra
7
- VERSION = '0.5.3'
7
+ VERSION = '0.5.4'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-identity-entra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity