-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathIdentityServerBuilderTestExtensions.cs
43 lines (41 loc) · 1.2 KB
/
IdentityServerBuilderTestExtensions.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
using IdentityServer4.Models;
using Microsoft.Extensions.DependencyInjection;
namespace LightweightApiWithAuth
{
public static class IdentityServerBuilderTestExtensions
{
public static IIdentityServerBuilder AddTestClients(this IIdentityServerBuilder builder)
{
return builder.AddInMemoryClients(new[] { new Client
{
ClientId = "client1",
ClientSecrets =
{
new Secret("secret1".Sha256())
},
AllowedGrantTypes = new[]
{
GrantType.ClientCredentials
},
AllowedScopes = new[]
{
"read"
}
}});
}
public static IIdentityServerBuilder AddTestResources(this IIdentityServerBuilder builder)
{
return builder.AddInMemoryApiResources(new[]
{
new ApiResource("embedded")
{
Scopes =
{
new Scope("read")
},
Enabled = true
},
});
}
}
}