Guest User

Untitled

a guest
Nov 3rd, 2023
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.43 KB | None | 0 0
  1. using Duende.IdentityServer;
  2. using Duende.IdentityServer.Models;
  3. using IdentityModel;
  4.  
  5. namespace HeadhuntNow.Auth;
  6.  
  7. public class Config
  8. {
  9.     private IConfiguration Configuration { get; set; }
  10.  
  11.     public Config(IConfiguration configuration)
  12.     {
  13.         Configuration = configuration;
  14.     }
  15.  
  16.     public IEnumerable<IdentityResource> IdentityResources =>
  17.         new List<IdentityResource>
  18.         {
  19.             new IdentityResources.OpenId(),
  20.             new IdentityResources.Profile(),
  21.             new()
  22.             {
  23.                 Name = "verification",
  24.                 UserClaims = new List<string>
  25.                 {
  26.                     JwtClaimTypes.Email,
  27.                     JwtClaimTypes.EmailVerified
  28.                 }
  29.             }
  30.         };
  31.  
  32.     public IEnumerable<ApiScope> ApiScopes =>
  33.         new List<ApiScope>
  34.         {
  35.         };
  36.  
  37.     public IEnumerable<ApiResource> ApiResources =>
  38.         new List<ApiResource>
  39.         {
  40.         };
  41.  
  42.     public IEnumerable<Client> GetClients() =>
  43.         new Client[]
  44.         {
  45.             new Client
  46.             {
  47.                 ClientId = "dev",
  48.                 ClientSecrets = { new Secret("secret".ToSha256()) },
  49.                 AllowedGrantTypes = GrantTypes.Code,
  50.                 EnableLocalLogin = true,
  51.                 ClientName = "Local Web",
  52.                 AllowedScopes = new List<string>
  53.                 {
  54.                     IdentityServerConstants.StandardScopes.OpenId,
  55.                     IdentityServerConstants.StandardScopes.Profile,
  56.                     "verification",
  57.                 },
  58.                 ClientUri = "https://localhost:5137",
  59.  
  60.                 AllowedCorsOrigins = new List<string>()
  61.                 {
  62.                     "https://localhost:5137",
  63.                 },
  64.  
  65.                 // where to redirect to after login
  66.                 RedirectUris =
  67.                 {
  68.                     // $"{Configuration["LoginRedirect"]}/signin-oidc"
  69.                     "https://localhost:5137/signin-oidc",
  70.                     "https://localhost:5137/authentication/login-callback",
  71.                     "https://localhost:5137/connect/authorize",
  72.                 },
  73.                 PostLogoutRedirectUris =
  74.                 {
  75.                     $"https://localhost:5137/signout-callback-oidc",
  76.                     $"https://localhost:5137/authentication/signout-callback-oidc",
  77.                 },
  78.             }
  79.         };
  80. }
Advertisement
Add Comment
Please, Sign In to add comment