microsoft-agents-hosting-core 0.5.0.dev11__py3-none-any.whl → 0.5.0.dev17__py3-none-any.whl

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.
@@ -118,20 +118,20 @@ class AgenticUserAuthorization(_AuthorizationHandler):
118
118
  connection = self._connection_manager.get_token_provider(
119
119
  context.identity, "agentic"
120
120
  )
121
- upn = context.activity.get_agentic_user()
121
+ agentic_user_id = context.activity.get_agentic_user()
122
122
  agentic_instance_id = context.activity.get_agentic_instance_id()
123
- if not upn or not agentic_instance_id:
123
+ if not agentic_user_id or not agentic_instance_id:
124
124
  logger.error(
125
- "Unable to retrieve agentic user token: missing UPN or agentic instance ID. UPN: %s, Agentic Instance ID: %s",
126
- upn,
125
+ "Unable to retrieve agentic user token: missing agentic user Id or agentic instance Id. agentic_user_id: %s, Agentic Instance ID: %s",
126
+ agentic_user_id,
127
127
  agentic_instance_id,
128
128
  )
129
129
  raise ValueError(
130
- f"Unable to retrieve agentic user token: missing UPN or agentic instance ID. UPN: {upn}, Agentic Instance ID: {agentic_instance_id}"
130
+ f"Unable to retrieve agentic user token: missing agentic User Id or agentic instance Id. agentic_user_id: {agentic_user_id}, Agentic Instance ID: {agentic_instance_id}"
131
131
  )
132
132
 
133
133
  token = await connection.get_agentic_user_token(
134
- agentic_instance_id, upn, scopes
134
+ agentic_instance_id, agentic_user_id, scopes
135
135
  )
136
136
  return TokenResponse(token=token) if token else TokenResponse()
137
137
 
@@ -43,6 +43,6 @@ class AccessTokenProviderBase(Protocol):
43
43
  raise NotImplementedError()
44
44
 
45
45
  async def get_agentic_user_token(
46
- self, agent_app_instance_id: str, upn: str, scopes: list[str]
46
+ self, agent_app_instance_id: str, agentic_user_id: str, scopes: list[str]
47
47
  ) -> Optional[str]:
48
48
  raise NotImplementedError()
@@ -33,6 +33,6 @@ class AnonymousTokenProvider(AccessTokenProviderBase):
33
33
  return "", ""
34
34
 
35
35
  async def get_agentic_user_token(
36
- self, agent_app_instance_id: str, upn: str, scopes: list[str]
36
+ self, agent_app_instance_id: str, agentic_user_id: str, scopes: list[str]
37
37
  ) -> Optional[str]:
38
38
  return ""
@@ -1,6 +1,7 @@
1
1
  # Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  # Licensed under the MIT License.
3
3
 
4
+ import asyncio
4
5
  import logging
5
6
  import jwt
6
7
 
@@ -16,10 +17,10 @@ class JwtTokenValidator:
16
17
  def __init__(self, configuration: AgentAuthConfiguration):
17
18
  self.configuration = configuration
18
19
 
19
- def validate_token(self, token: str) -> ClaimsIdentity:
20
+ async def validate_token(self, token: str) -> ClaimsIdentity:
20
21
 
21
22
  logger.debug("Validating JWT token.")
22
- key = self._get_public_key_or_secret(token)
23
+ key = await self._get_public_key_or_secret(token)
23
24
  decoded_token = jwt.decode(
24
25
  token,
25
26
  key=key,
@@ -39,7 +40,7 @@ class JwtTokenValidator:
39
40
  logger.debug("Returning anonymous claims identity.")
40
41
  return ClaimsIdentity({}, False, authentication_type="Anonymous")
41
42
 
42
- def _get_public_key_or_secret(self, token: str) -> PyJWK:
43
+ async def _get_public_key_or_secret(self, token: str) -> PyJWK:
43
44
  header = get_unverified_header(token)
44
45
  unverified_payload: dict = decode(token, options={"verify_signature": False})
45
46
 
@@ -50,5 +51,6 @@ class JwtTokenValidator:
50
51
  )
51
52
  jwks_client = PyJWKClient(jwksUri)
52
53
 
53
- key = jwks_client.get_signing_key(header["kid"])
54
+ key = await asyncio.to_thread(jwks_client.get_signing_key, header["kid"])
55
+
54
56
  return key
@@ -1,16 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-hosting-core
3
- Version: 0.5.0.dev11
3
+ Version: 0.5.0.dev17
4
4
  Summary: Core library for Microsoft Agents
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/microsoft/Agents
8
8
  Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
9
14
  Classifier: Operating System :: OS Independent
10
15
  Requires-Python: >=3.10
11
16
  Description-Content-Type: text/markdown
12
17
  License-File: LICENSE
13
- Requires-Dist: microsoft-agents-activity==0.5.0.dev11
18
+ Requires-Dist: microsoft-agents-activity==0.5.0.dev17
14
19
  Requires-Dist: pyjwt>=2.10.1
15
20
  Requires-Dist: isodate>=0.6.1
16
21
  Requires-Dist: azure-core>=1.30.0
@@ -34,21 +34,21 @@ microsoft_agents/hosting/core/app/oauth/authorization.py,sha256=_sdCZcZ7iciwTZqX
34
34
  microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py,sha256=ZQuXF-IZrJv_hOgt-sdRFAUyIpRXaYqYBuyEJWJRcfU,376
35
35
  microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py,sha256=W36Y1m0zFaRmdt-cL3ZKoHxx95y0O7YJF9D0cXx_s24,4185
36
36
  microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py,sha256=o_pn5ZO7O-YvcC5NGlUgcCmVLD-f6KwQ5CRIsPp8zQE,10186
37
- microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py,sha256=7rGzYRLOzcy9vGAwnzjyImEaCy0G_bRUwufuXp3xiwk,7145
37
+ microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py,sha256=4EgZxSMoymgap54xhoEQH0UIEBap-mMCiP6eFeanr3A,7253
38
38
  microsoft_agents/hosting/core/app/state/__init__.py,sha256=aL_8GB7_de8LUSEOgTJQFRx1kvgvJHHJVv7nWAoRPmU,331
39
39
  microsoft_agents/hosting/core/app/state/conversation_state.py,sha256=LfcSwvhaU0JeAahwg9YA9uz0kKHa9c6Y3XBAWqwuMg0,1593
40
40
  microsoft_agents/hosting/core/app/state/state.py,sha256=Q1GMGTdIGpu5Z4_6HPCfhJaD265oBlv6DMNNBCUyG3U,7372
41
41
  microsoft_agents/hosting/core/app/state/temp_state.py,sha256=Oh7K5-uYf50Z-lBXqttSMl2N1lRakktOmjLlIAKcEsM,3501
42
42
  microsoft_agents/hosting/core/app/state/turn_state.py,sha256=rEIRkwBsn3MPbrfKNjX8XqqbF-4THepMXU75KvDsBvM,9868
43
43
  microsoft_agents/hosting/core/authorization/__init__.py,sha256=pOTmTJFS5CMPEcHRadBTgrbWUP5lOIxsPMgTreFq7mw,634
44
- microsoft_agents/hosting/core/authorization/access_token_provider_base.py,sha256=AQROUB0U3C1vo4skM-bMOOLerqI0PrM2adKBBN7zJJo,1634
44
+ microsoft_agents/hosting/core/authorization/access_token_provider_base.py,sha256=Z0nGkfOUSIBvJSFjGGNQEd1-upqZVjT6eSXsqsFa2Cc,1646
45
45
  microsoft_agents/hosting/core/authorization/agent_auth_configuration.py,sha256=meLUO0Mwb9SBr01dLvYS9q3xuZyndCsb_gIx0r7__Sk,2944
46
- microsoft_agents/hosting/core/authorization/anonymous_token_provider.py,sha256=AzmwU7uqG6zX3Qw5_4Lenv18gHfLM55D6e_n2wGupy4,1064
46
+ microsoft_agents/hosting/core/authorization/anonymous_token_provider.py,sha256=44XKaSLJFZj4hCSAdWAtW1R31M5QCZVaFKJaxcwx5h4,1076
47
47
  microsoft_agents/hosting/core/authorization/auth_types.py,sha256=Fg_ywEItm3xL_DBUNzi0QsfDPVY5S3HlAiNw6I2SW64,374
48
48
  microsoft_agents/hosting/core/authorization/authentication_constants.py,sha256=ABEwosDCMYhubDiGrD8QULboTkACqDvNp_x_XBPt6dQ,4618
49
49
  microsoft_agents/hosting/core/authorization/claims_identity.py,sha256=ttnJpQx-2uAlwby_xRRmyHmyUPjzQjW86GO9FVzZK3Y,2501
50
50
  microsoft_agents/hosting/core/authorization/connections.py,sha256=f_NQpuJzhCBNZLk56SK4kvb_V_g2x2XMnFwWbYyDX_s,1247
51
- microsoft_agents/hosting/core/authorization/jwt_token_validator.py,sha256=LzVC4xfWieBDXqPH4kjM5ec2idEmkzo9-v3tTxywgdY,1966
51
+ microsoft_agents/hosting/core/authorization/jwt_token_validator.py,sha256=b440T7y1tM7gPUQZ27EA3SgNiaEupxz56E6773gL5Zo,2025
52
52
  microsoft_agents/hosting/core/client/__init__.py,sha256=HMWtSUXu1akaX6qtDx412Lr8vLi5SEslc-DYrvZAPWs,1299
53
53
  microsoft_agents/hosting/core/client/agent_conversation_reference.py,sha256=3Zf3IGbJVWv4pF6kA6vtWkpV3Ap3z6jVkimeEtFMvJI,288
54
54
  microsoft_agents/hosting/core/client/channel_factory_protocol.py,sha256=r270WJwySugnzY4AITT8oSRQHKqeqYAknkmD2eq_CqA,394
@@ -91,8 +91,8 @@ microsoft_agents/hosting/core/storage/transcript_info.py,sha256=5VN32j99tshChAff
91
91
  microsoft_agents/hosting/core/storage/transcript_logger.py,sha256=_atDk3CJ05fIVMhlWGNa91IiM9bGLmOhasFko8Lxjhk,8237
92
92
  microsoft_agents/hosting/core/storage/transcript_memory_store.py,sha256=v1Ud9LSs8m5c9_Fa8i49SuAjw80dX1hDciqbRduDEOE,6444
93
93
  microsoft_agents/hosting/core/storage/transcript_store.py,sha256=ka74o0WvI5GhMZcFqSxVdamBhGzZcDZe6VNkG-sMy74,1944
94
- microsoft_agents_hosting_core-0.5.0.dev11.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
95
- microsoft_agents_hosting_core-0.5.0.dev11.dist-info/METADATA,sha256=Rtru58Gme9kAIxyZrWPIGmCLWij8GWc7JQTPjiCyAOA,8597
96
- microsoft_agents_hosting_core-0.5.0.dev11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
- microsoft_agents_hosting_core-0.5.0.dev11.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
98
- microsoft_agents_hosting_core-0.5.0.dev11.dist-info/RECORD,,
94
+ microsoft_agents_hosting_core-0.5.0.dev17.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
95
+ microsoft_agents_hosting_core-0.5.0.dev17.dist-info/METADATA,sha256=uZU4P_eK-dl83va49VTZJmqxj8ujFr9GJjeUMVzPRIY,8852
96
+ microsoft_agents_hosting_core-0.5.0.dev17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
+ microsoft_agents_hosting_core-0.5.0.dev17.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
98
+ microsoft_agents_hosting_core-0.5.0.dev17.dist-info/RECORD,,