-
Notifications
You must be signed in to change notification settings - Fork 232
/
Config.cs
58 lines (54 loc) · 1.87 KB
/
Config.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System.Collections.Generic;
using AuthServer.Infrastructure.Constants;
using IdentityServer4;
using IdentityServer4.Models;
namespace AuthServer.Api
{
public class Config
{
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Email(),
new IdentityResources.Profile(),
};
}
public static IEnumerable<ApiResource> GetApiResources()
{
return new List<ApiResource>
{
new ApiResource(Roles.Consumer, "Aycoutay API")
};
}
public static IEnumerable<Client> GetClients()
{
// client credentials client
return new List<Client>
{
// resource owner password grant client
new Client
{
ClientId = "ro.aycoutay-mobile",
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
ClientSecrets =
{
new Secret("secret".Sha256())
},
AllowedScopes = {
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.Address,
Roles.Consumer
},
AllowOfflineAccess = true,
// Access token life time is 90 days
AccessTokenLifetime = 7776000,
AbsoluteRefreshTokenLifetime = 10368000 // 120 days
}
};
}
}
}