forked from binarythistle/Secure-Daemon-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AuthConfig.cs
37 lines (32 loc) · 924 Bytes
/
AuthConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.IO;
using System.Globalization;
using Microsoft.Extensions.Configuration;
namespace CommandAPIClient
{
public class AuthConfig
{
public string Instance {get; set;} = "https://login.microsoftonline.com/{0}";
public string TenantId {get; set;}
public string ClientId {get; set;}
public string Authority
{
get
{
return String.Format(CultureInfo.InvariantCulture, Instance, TenantId);
}
}
public string ClientSecret {get; set;}
public string BaseAddress {get; set;}
public string ResourceID {get; set;}
public static AuthConfig ReadFromJsonFile(string path)
{
IConfiguration Configuration;
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile(path);
Configuration = builder.Build();
return Configuration.Get<AuthConfig>();
}
}
}