lex-microsoft_teams 0.6.40 → 0.6.42

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: f6f9d39d6ddf7f53a0d22f727e6ca9cfede2aa3487cef4c8ffee064b549a158c
4
- data.tar.gz: efbe44cedda75981daae45b173f795c968f2883e17d8526b512c0324a9269e73
3
+ metadata.gz: b320641fa223ed514787d28161d2072d039da5a34ec81ab9cfe2f4289b5403ba
4
+ data.tar.gz: b13504e4b41e1ff97360a7a0cedea33989b9649798009a1f2bda16bcff312962
5
5
  SHA512:
6
- metadata.gz: 2147849085641ca61d971a3f7b37009a481285cf9edb1dead731d03f6007dac3845168d2aeeb19f6737cd8673144e0673b860e924676136b7c6213ef61240114
7
- data.tar.gz: 297f2da23ebd6a9db658ca27eecb1504376cee05745f4dea3e5b9b5d4a29d33923c28375a766b99de9a5e58d935dc6688c3552cb55442514b4a187085335f7a2
6
+ metadata.gz: 1064e76e545459d2e14c399b5610ede6e24fbb126a9c917806d992b6aa738e69fa27cc4ee6de50b8aec357f4fb53029c7c7f113e38d7cc720dd1c1a9f8879936
7
+ data.tar.gz: dff546a2489dc75715e2355c16237f4e1ad0f0677866c1f464f35791c3747ab70b7e31b692d3602680f57434c7d0529f099191c6b59f079a07353bdc9933299b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.6.42] - 2026-04-23
6
+
7
+ ### Fixed
8
+ - `Helpers::TokenCache#vault_path` — replaced `ENV.fetch('USER', 'default')` with `Legion::Identity::Process.canonical_name` (the resolved Kerberos/LDAP identity), matching the pattern used in `legion-llm` PR #80. Falls back to `ENV['USER'].split('@').first` (email domain stripped) if Identity is not yet resolved
9
+ - Also removed the `microsoft_teams` namespace segment from the returned suffix — `Crypt::Helper#vault_write` wraps the path in its own `vault_path(suffix)` which already prepends the lex namespace, so including it again caused double-prefixed Vault paths (`microsoft_teams/users/.../microsoft_teams/delegated_token`).
10
+ - Final Vault path is now: `microsoft_teams/users/{canonical_name}/delegated_token`
11
+ - Configurable via `settings[:auth][:delegated][:vault_path]` if a custom path is needed
12
+
13
+ ## [0.6.41] - 2026-04-23
14
+
15
+ ### Fixed
16
+ - `Helpers::Client#graph_connection` and `#bot_connection` — replaced `Legion::Settings[:microsoft_teams]` with `settings` (provided by `Legion::Settings::Helper` via `Helpers::Lex`), which correctly scopes to the lex key automatically and is the approved pattern inside a lex
17
+ - `Helpers::TokenCache#teams_auth_settings` — same fix; replaced `Legion::Settings[:microsoft_teams]` with `settings`, removed the now-redundant `defined?(Legion::Settings)` guard and `if ms` nil guards (settings always returns a Hash)
18
+ - The only remaining `Legion::Settings` references in `token_cache.rb` are for cross-lex lookups (`:crypt, :vault, :connected`) which are intentional and correct
19
+ - Token write paths (`save_to_local`, `save_to_vault`) confirmed clean — write to `local_token_path` (defaulting to `~/.legionio/tokens/`) and Vault respectively, not into settings
20
+
5
21
  ## [0.6.40] - 2026-04-23
6
22
 
7
23
  ### Fixed
@@ -7,8 +7,11 @@ module Legion
7
7
  module MicrosoftTeams
8
8
  module Helpers
9
9
  module Client
10
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
11
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
12
+
10
13
  def graph_connection(token: nil, api_url: 'https://graph.microsoft.com/v1.0', **_opts)
11
- token ||= Legion::Settings[:microsoft_teams]&.dig(:auth, :delegated, :token)
14
+ token ||= settings&.dig(:auth, :delegated, :token)
12
15
  Faraday.new(url: api_url) do |conn|
13
16
  conn.request :json
14
17
  conn.response :json, content_type: /\bjson$/
@@ -18,7 +21,7 @@ module Legion
18
21
  end
19
22
 
20
23
  def bot_connection(token: nil, service_url: 'https://smba.trafficmanager.net/teams/', **_opts)
21
- token ||= Legion::Settings[:microsoft_teams]&.dig(:auth, :bot, :token)
24
+ token ||= settings&.dig(:auth, :bot, :token)
22
25
  Faraday.new(url: service_url) do |conn|
23
26
  conn.request :json
24
27
  conn.response :json, content_type: /\bjson$/
@@ -277,8 +277,14 @@ module Legion
277
277
  def vault_path(_suffix = nil)
278
278
  settings = teams_auth_settings
279
279
  delegated = settings[:delegated]
280
- custom = delegated[:vault_path] if delegated.is_a?(Hash)
281
- custom || "users/#{ENV.fetch('USER', 'default')}/microsoft_teams/delegated_token"
280
+ return delegated[:vault_path] if delegated.is_a?(Hash) && delegated[:vault_path]
281
+
282
+ identity = if defined?(Legion::Identity::Process) && Legion::Identity::Process.resolved?
283
+ Legion::Identity::Process.canonical_name
284
+ else
285
+ ENV.fetch('USER', 'default').split('@').first
286
+ end
287
+ "users/#{identity}/delegated_token"
282
288
  end
283
289
 
284
290
  def local_token_path
@@ -387,13 +393,11 @@ module Legion
387
393
  end
388
394
 
389
395
  def teams_auth_settings
390
- return {} unless defined?(Legion::Settings)
391
-
392
- ms = Legion::Settings[:microsoft_teams]
393
- auth = ms && ms[:auth].is_a?(Hash) ? ms[:auth].dup : {}
394
- auth[:tenant_id] ||= ms[:tenant_id] if ms
395
- auth[:client_id] ||= ms[:client_id] if ms
396
- auth[:client_secret] ||= ms[:client_secret] if ms
396
+ ms = settings
397
+ auth = ms[:auth].is_a?(Hash) ? ms[:auth].dup : {}
398
+ auth[:tenant_id] ||= ms[:tenant_id]
399
+ auth[:client_id] ||= ms[:client_id]
400
+ auth[:client_secret] ||= ms[:client_secret]
397
401
  auth[:tenant_id] ||= ENV.fetch('AZURE_TENANT_ID', nil)
398
402
  auth[:client_id] ||= ENV.fetch('AZURE_CLIENT_ID', nil)
399
403
  auth[:client_secret] ||= ENV.fetch('AZURE_CLIENT_SECRET', nil)
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module MicrosoftTeams
6
- VERSION = '0.6.40'
6
+ VERSION = '0.6.42'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-microsoft_teams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.40
4
+ version: 0.6.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity