From d7b5f8b7775a7c623d4bcfa7015476f835aabfa2 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Thu, 6 Aug 2020 23:28:30 +0200 Subject: server: start of ids4 impl --- src/server/IdentityServer/Config.cs | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/server/IdentityServer/Config.cs (limited to 'src/server/IdentityServer/Config.cs') diff --git a/src/server/IdentityServer/Config.cs b/src/server/IdentityServer/Config.cs new file mode 100644 index 0000000..41363f1 --- /dev/null +++ b/src/server/IdentityServer/Config.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using Dough.Models; +using IdentityServer4; +using IdentityServer4.Models; + +namespace Dough.IdentityServer +{ + public static class Config + { + private const string MainApiScopeName = "main_api"; + private const string BrowserClientId = "browser"; + + + public static IEnumerable Clients => new List + { + new Client + { + ClientId = BrowserClientId, + AllowedGrantTypes = GrantTypes.Code, + RequireClientSecret = false, + + RedirectUris = Constants.BrowserAppLoginRedirectUrls, + PostLogoutRedirectUris = Constants.BrowserAppLogoutRedirectUrls, + AllowedCorsOrigins = Constants.BrowserAppUrls, + + AllowedScopes = + { + IdentityServerConstants.StandardScopes.OpenId, + IdentityServerConstants.StandardScopes.Profile, + MainApiScopeName + } + } + }; + + public static IEnumerable ApiScopes => + new List + { + new ApiScope(MainApiScopeName) + }; + + public static IEnumerable IdentityResources => + new List + { + new IdentityResources.OpenId(), + new IdentityResources.Profile(), + }; + } +} -- cgit v1.3