-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConfig.cs
107 lines (93 loc) · 3.17 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Test;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WebApplicationBasic
{
}
public class Config
{
public static string HOST_URL = "http://localhost:5000";
public static IEnumerable<ApiResource> GetApiResources()
{
var api1 = new ApiResource("api1", "My API");
api1.ApiSecrets = new List<Secret> { new Secret("secret".Sha256()) };
return new List<ApiResource>
{
api1
};
}
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
new Client
{
ClientId = "demo-resource-owner",
ClientName = "JavaScript Resource Owner Client",
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
ClientSecrets=new List<Secret>{ new Secret( "secret".Sha256(), "2017 secret")},
RedirectUris = { "http://localhost:5000/login" },
PostLogoutRedirectUris = { "http://localhost:5000" },
AllowedCorsOrigins = { "http://localhost:5000/" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api1"
},
AllowOfflineAccess = true,AlwaysIncludeUserClaimsInIdToken=true
},
new Client
{
ClientId = "js",
ClientName = "JavaScript Client",
AllowedGrantTypes = GrantTypes.Implicit,
ClientSecrets=new List<Secret>{ new Secret( "secret".Sha256(), "2017 secret")},
AllowAccessTokensViaBrowser = true,
RequireClientSecret=false,
RequireConsent=false,
RedirectUris = { "http://localhost:5000/login" },
PostLogoutRedirectUris = { "http://localhost:5000" },
AllowedCorsOrigins = { "http://localhost:5000/" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api1"
},
AllowOfflineAccess = true,AlwaysIncludeUserClaimsInIdToken=true
},
};
}
public static List<TestUser> GetUsers()
{
return new List<TestUser>
{
new TestUser
{
SubjectId = "1",
Username = "username",
Password = "password"
},
new TestUser
{
SubjectId = "2",
Username = "bob",
Password = "password"
}
};
}
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
new IdentityResources.Email()
};
}
}