microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
dev

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

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
4using Microsoft.Teams.Api.Auth;
5
6namespace Microsoft.Teams.Apps.Extensions;
7
8public 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}