microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
teams.net/Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Configuration/Microsoft.Teams.Apps.Extensions
Libraries/Microsoft.Teams.Extensions/Microsoft.Teams.Extensions.Configuration/Microsoft.Teams.Apps.Extensions/TeamsSettings.cs
30lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Api.Auth; |
| 5 | |
| 6 | namespace Microsoft.Teams.Apps.Extensions; |
| 7 | |
| 8 | public class TeamsSettings |
| 9 | { |
| 10 | public string? ClientId { get; set; } |
| 11 | public string? ClientSecret { get; set; } |
| 12 | public string? TenantId { get; set; } |
| 13 | |
| 14 | public bool Empty |
| 15 | { |
| 16 | get { return ClientId == "" || ClientSecret == ""; } |
| 17 | } |
| 18 | |
| 19 | public AppOptions Apply(AppOptions? options = null) |
| 20 | { |
| 21 | options ??= new AppOptions(); |
| 22 | |
| 23 | if (ClientId is not null && ClientSecret is not null && !Empty) |
| 24 | { |
| 25 | options.Credentials = new ClientCredentials(ClientId, ClientSecret, TenantId); |
| 26 | } |
| 27 | |
| 28 | return options; |
| 29 | } |
| 30 | } |