-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathConfig.cs
172 lines (158 loc) · 5.9 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
using System.Security.Cryptography.X509Certificates;
using Duende.IdentityModel;
using Duende.IdentityServer;
using Duende.IdentityServer.Models;
using Rsk.Saml;
using Rsk.Saml.Models;
using ServiceProvider = Rsk.Saml.Models.ServiceProvider;
namespace IdentityServer;
public static class Config
{
public static IEnumerable<IdentityResource> IdentityResources =>
new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
new IdentityResource()
{
Name = "verification",
UserClaims = new List<string>
{
JwtClaimTypes.Email,
JwtClaimTypes.EmailVerified
}
}
};
public static IEnumerable<ApiScope> ApiScopes =>
new List<ApiScope>
{
new ApiScope("api1", "MyAPI")
};
public static IEnumerable<ApiResource> ApiResources =>
new List<ApiResource>
{
};
public static IEnumerable<Client> Clients =>
new List<Client>
{
// machine-to-machine client (from quickstart 1)
new Client
{
ClientId = "client",
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.ClientCredentials,
// scopes that client has access to
AllowedScopes = { "api1" },
},
// interactive ASP.NET Core Web App
new Client
{
ClientId = "web",
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.Code,
// where to redirect after login
RedirectUris = { "https://localhost:5002/signin-oidc" },
// where to redirect after logout
PostLogoutRedirectUris = { "https://localhost:5002/signout-callback-oidc" },
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"verification"
}
},
new Client()
{
ClientId = "https://localhost:5002",
ProtocolType = IdentityServerConstants.ProtocolTypes.Saml2p,
RedirectUris = new List<string>()
{
"https://localhost:5002/signin-saml"
},
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
}
},
new Client()
{
ClientId = "https://localhost:5003",
ProtocolType = IdentityServerConstants.ProtocolTypes.Saml2p,
RedirectUris = new List<string>()
{
"https://localhost:5003/signin-saml"
},
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
}
},
new Client()
{
ClientId = "https://localhost:5004",
ProtocolType = IdentityServerConstants.ProtocolTypes.Saml2p,
RedirectUris = new List<string>()
{
"https://localhost:5004/signin-saml"
},
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
}
}
};
public static IEnumerable<ServiceProvider> ServiceProvider => new List<ServiceProvider>()
{
new ServiceProvider()
{
EntityId = "https://localhost:5002",
AssertionConsumerServices = new List<Service>()
{
new Service(SamlConstants.BindingTypes.HttpPost, "https://localhost:5002/signin-saml")
},
SingleLogoutServices = new List<Service>()
{
new Service(SamlConstants.BindingTypes.HttpPost, "https://localhost:5002/signout-saml")
},
SigningCertificates = new List<X509Certificate2>()
{
new X509Certificate2("Resources/testclient.cer")
}
},
new ServiceProvider()
{
EntityId = "https://localhost:5003",
AssertionConsumerServices = new List<Service>()
{
new Service(SamlConstants.BindingTypes.HttpPost, "https://localhost:5003/signin-saml")
},
SingleLogoutServices = new List<Service>()
{
new Service(SamlConstants.BindingTypes.HttpPost, "https://localhost:5003/signout-saml")
},
SigningCertificates = new List<X509Certificate2>()
{
new X509Certificate2("Resources/testclient.cer")
}
},
new ServiceProvider()
{
EntityId = "https://localhost:5004",
AssertionConsumerServices = new List<Service>()
{
new Service(SamlConstants.BindingTypes.HttpPost, "https://localhost:5004/signin-saml")
},
SingleLogoutServices = new List<Service>()
{
new Service(SamlConstants.BindingTypes.HttpPost, "https://localhost:5004/signout-saml")
},
SigningCertificates = new List<X509Certificate2>()
{
new X509Certificate2("Resources/testclient.cer")
}
}
};
}