yavsc/src/Yavsc.Server/Config.cs

93 lines
3.2 KiB
C#
Raw Normal View History

2024-11-06 13:00:34 +00:00

2025-02-08 20:06:24 +00:00
using IdentityServer8;
using IdentityServer8.Models;
2025-02-14 00:20:35 +00:00
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
2024-02-25 18:05:10 +00:00
using Yavsc.Settings;
2024-02-14 20:35:15 +00:00
namespace Yavsc;
public static class Config
{
2024-02-25 18:05:10 +00:00
public static string Authority { get; set; }
public static IConfigurationRoot? GoogleWebClientConfiguration { get; set; }
public static GoogleServiceAccount? GServiceAccount { get; set; }
public static SiteSettings SiteSetup { get; set; }
public static FileServerOptions UserFilesOptions { get; set; }
public static FileServerOptions GitOptions { get; set; }
public static string AvatarsDirName { set; get; }
public static string GitDirName { set; get; }
public static GoogleAuthSettings GoogleSettings { get; set; }
public static SmtpSettings SmtpSetup { get; set; }
public static string Temp { get; set; }
public static FileServerOptions AvatarsOptions { get; set; }
public static string UserBillsDirName { set; get; }
public static string UserFilesDirName { set; get; }
/// <summary>
/// Lists Available user profile classes,
/// populated at startup, using reflexion.
/// </summary>
public static List<Type> ProfileTypes = new List<Type>();
2024-02-14 20:35:15 +00:00
public static IEnumerable<IdentityResource> IdentityResources =>
new IdentityResource[]
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
2025-02-09 12:04:14 +00:00
new IdentityResources.Email()
2024-02-14 20:35:15 +00:00
};
public static IEnumerable<ApiScope> ApiScopes =>
new ApiScope[]
{
2025-02-15 20:10:01 +00:00
new ApiScope("scope1",new string[] {"scope1"}),
new ApiScope("scope2",new string[] {"scope2"}),
2024-02-14 20:35:15 +00:00
};
public static IEnumerable<Client> Clients =>
new Client[]
{
// m2m client credentials flow client
new Client
{
ClientId = "m2m.client",
ClientName = "Client Credentials Client",
AllowedGrantTypes = GrantTypes.ClientCredentials,
ClientSecrets = { new Secret("511536EF-F270-4058-80CA-1C89C192F69A".Sha256()) },
AllowedScopes = { "scope1" }
},
// interactive client using code flow + pkce
new Client
{
2025-02-08 20:06:24 +00:00
ClientId = "mvc",
2024-02-14 20:35:15 +00:00
ClientSecrets = { new Secret("49C1A7E1-0C79-4A89-A3D6-A37998FB86B0".Sha256()) },
AllowedGrantTypes = GrantTypes.Code,
2025-02-08 20:06:24 +00:00
RedirectUris = { "https://localhost:5003/signin-oidc",
"http://localhost:5002/signin-oidc" },
2024-02-25 18:05:10 +00:00
PostLogoutRedirectUris = { "https://localhost:5003/signout-callback-oidc" },
2024-02-14 20:35:15 +00:00
AllowOfflineAccess = true,
2025-02-11 04:45:05 +00:00
2025-02-08 20:06:24 +00:00
AllowedScopes = {
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
2025-02-09 16:57:10 +00:00
IdentityServerConstants.StandardScopes.Email,
2025-02-11 04:45:05 +00:00
IdentityServerConstants.StandardScopes.OfflineAccess,
2025-02-09 16:57:10 +00:00
"scope2" }
2024-02-14 20:35:15 +00:00
},
};
2024-02-25 18:05:10 +00:00
public static PayPalSettings PayPalSettings { get; set; }
2024-02-14 20:35:15 +00:00
}