-
Notifications
You must be signed in to change notification settings - Fork 11
Add AsyncContextualTokenResolver for agentic user ID support in token resolution #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/Observability/Runtime/Tracing/Exporters/AgentIdentity.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Agents.A365.Observability.Runtime.Tracing.Exporters | ||
| { | ||
| /// <summary> | ||
| /// Represents the identity of an agent and its acting user. | ||
| /// <para> | ||
| /// In the AI teammate scenario, <see cref="AgenticUserId"/> is 1:1 with <see cref="AgentId"/>. | ||
| /// In the S2S scenario, <see cref="AgenticUserId"/> will be null. | ||
| /// </para> | ||
| /// </summary> | ||
| public class AgentIdentity | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AgentIdentity"/> class. | ||
| /// </summary> | ||
| /// <param name="agentId">The agent identifier.</param> | ||
| /// <param name="agenticUserId">The agentic user identifier (AAD Object ID), or null in S2S scenarios.</param> | ||
| public AgentIdentity(string agentId, string? agenticUserId = null) | ||
| { | ||
| AgentId = agentId; | ||
| AgenticUserId = agenticUserId; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the agent identifier. | ||
| /// </summary> | ||
| public string AgentId { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the agentic user identifier (AAD Object ID). | ||
| /// In the AI teammate scenario, this value is 1:1 with <see cref="AgentId"/>. | ||
| /// Will be null in the S2S scenario. | ||
| /// </summary> | ||
| public string? AgenticUserId { get; } | ||
| } | ||
| } |
38 changes: 38 additions & 0 deletions
38
src/Observability/Runtime/Tracing/Exporters/TokenResolverContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Agents.A365.Observability.Runtime.Tracing.Exporters | ||
| { | ||
| /// <summary> | ||
| /// Provides contextual information to the token resolver delegate. | ||
| /// <para> | ||
| /// <see cref="Identity"/> provides first-class access to agent identity fields (agent ID, | ||
| /// agentic user ID). <see cref="TenantId"/> and <see cref="Identity"/> | ||
| /// together identify the cache key. | ||
| /// </para> | ||
| /// </summary> | ||
| public class TokenResolverContext | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="TokenResolverContext"/> class. | ||
| /// </summary> | ||
| /// <param name="identity">The agent identity associated with this request.</param> | ||
| /// <param name="tenantId">The tenant identifier (cache key).</param> | ||
| public TokenResolverContext(AgentIdentity identity, string tenantId) | ||
| { | ||
| Identity = identity; | ||
| TenantId = tenantId; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the agent identity associated with this token resolution request. | ||
| /// Contains the agent ID and agentic user ID (AAD Object ID) as first-class properties. | ||
| /// </summary> | ||
| public AgentIdentity Identity { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the tenant identifier (part of the cache key). | ||
| /// </summary> | ||
| public string TenantId { get; } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.