microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
core/src/Microsoft.Teams.Apps/Api/Clients/BotSignInClient.cs
38lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Core; |
| 5 | |
| 6 | using CoreUserTokenClient = Microsoft.Teams.Core.UserTokenClient; |
| 7 | |
| 8 | namespace Microsoft.Teams.Apps.Api.Clients; |
| 9 | |
| 10 | /// <summary> |
| 11 | /// Client for bot sign-in operations. |
| 12 | /// Delegates to the core <see cref="CoreUserTokenClient"/>. |
| 13 | /// </summary> |
| 14 | public class BotSignInClient |
| 15 | { |
| 16 | private readonly CoreUserTokenClient _client; |
| 17 | |
| 18 | internal BotSignInClient(CoreUserTokenClient client) |
| 19 | { |
| 20 | _client = client; |
| 21 | } |
| 22 | |
| 23 | /// <summary> |
| 24 | /// Get the sign-in URL for a connection. |
| 25 | /// </summary> |
| 26 | public Task<string?> GetUrlAsync(string state, string? codeChallenge = null, Uri? emulatorUrl = null, Uri? finalRedirect = null, CancellationToken cancellationToken = default) |
| 27 | { |
| 28 | return _client.GetSignInUrlAsync(state, codeChallenge, emulatorUrl, finalRedirect, cancellationToken); |
| 29 | } |
| 30 | |
| 31 | /// <summary> |
| 32 | /// Get the sign-in resource for a connection. |
| 33 | /// </summary> |
| 34 | public Task<GetSignInResourceResult?> GetResourceAsync(string state, string? codeChallenge = null, Uri? emulatorUrl = null, Uri? finalRedirect = null, CancellationToken cancellationToken = default) |
| 35 | { |
| 36 | return _client.GetSignInResourceAsync(state, codeChallenge, emulatorUrl, finalRedirect, cancellationToken)!; |
| 37 | } |
| 38 | } |
| 39 | |