aboutsummaryrefslogtreecommitdiffstats
path: root/src/server/IdentityServer/Config.cs
blob: ac38aa4fffa0835890c255a6e42f1308c41a8417 (plain) (blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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<Client> Clients => new List<Client>
        {
            new Client
            {
                ClientId = BrowserClientId,
                AllowedGrantTypes = GrantTypes.Code,
                RequireClientSecret = false,
                RedirectUris = Constants.BrowserAppLoginRedirectUrls,
                PostLogoutRedirectUris = Constants.BrowserAppLogoutRedirectUrls,
                AllowedCorsOrigins = Constants.BrowserAppUrls,
                AccessTokenType = AccessTokenType.Reference,
                RequireConsent = false,
                RefreshTokenExpiration = TokenExpiration.Sliding,
                RefreshTokenUsage = TokenUsage.ReUse,
                AlwaysSendClientClaims = true,
                AllowOfflineAccess = true,
                AllowedScopes =
                {
                    IdentityServerConstants.StandardScopes.OpenId,
                    IdentityServerConstants.StandardScopes.Profile,
                    IdentityServerConstants.StandardScopes.OfflineAccess,
                    MainApiScopeName
                }
            }
        };

        public static IEnumerable<ApiScope> ApiScopes =>
            new List<ApiScope>
            {
                new ApiScope(MainApiScopeName)
            };

        public static IEnumerable<IdentityResource> IdentityResources =>
            new List<IdentityResource>
            {
                new IdentityResources.OpenId(),
                new IdentityResources.Profile(),
            };
    }
}