microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
core/src/Microsoft.Teams.Bot.Core/Schema/AgenticIdentity.cs
47lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | namespace Microsoft.Teams.Bot.Core.Schema; |
| 5 | |
| 6 | /// <summary> |
| 7 | /// Represents an agentic identity for user-delegated token acquisition. |
| 8 | /// </summary> |
| 9 | public sealed class AgenticIdentity |
| 10 | { |
| 11 | /// <summary> |
| 12 | /// Agentic application ID. |
| 13 | /// </summary> |
| 14 | public string? AgenticAppId { get; set; } |
| 15 | /// <summary> |
| 16 | /// Agentic user ID. |
| 17 | /// </summary> |
| 18 | public string? AgenticUserId { get; set; } |
| 19 | |
| 20 | /// <summary> |
| 21 | /// Agentic application blueprint ID. |
| 22 | /// </summary> |
| 23 | public string? AgenticAppBlueprintId { get; set; } |
| 24 | |
| 25 | /// <summary> |
| 26 | /// Creates an <see cref="AgenticIdentity"/> instance from the provided properties dictionary. |
| 27 | /// </summary> |
| 28 | /// <param name="properties"></param> |
| 29 | /// <returns></returns> |
| 30 | public static AgenticIdentity? FromProperties(ExtendedPropertiesDictionary? properties) |
| 31 | { |
| 32 | if (properties is null) |
| 33 | { |
| 34 | return null; |
| 35 | } |
| 36 | |
| 37 | properties.TryGetValue("agenticAppId", out object? appIdObj); |
| 38 | properties.TryGetValue("agenticUserId", out object? userIdObj); |
| 39 | properties.TryGetValue("agenticAppBlueprintId", out object? bluePrintObj); |
| 40 | return new AgenticIdentity |
| 41 | { |
| 42 | AgenticAppId = appIdObj?.ToString(), |
| 43 | AgenticUserId = userIdObj?.ToString(), |
| 44 | AgenticAppBlueprintId = bluePrintObj?.ToString() |
| 45 | }; |
| 46 | } |
| 47 | } |
| 48 | |