Skip to content

Commit 6a86ed7

Browse files
committed
Migration to PostgreSQL
1 parent 1f4a23d commit 6a86ed7

11 files changed

+76
-123
lines changed

IdentityServer.PostgreSQL.sln

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26430.4
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29001.49
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A0F6C07F-188D-4F86-B43F-4A3EAD0D2C30}"
77
EndProject
@@ -24,6 +24,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StsServerIdentity", "src\St
2424
EndProject
2525
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AngularClientCode", "src\AngularClientCode\AngularClientCode.csproj", "{D97F476C-CD83-432E-AC15-077C91F78B79}"
2626
EndProject
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AngularClient1", "src\AngularClient1\AngularClient1.csproj", "{3E9F1A73-41EC-474C-A07C-DA0DD3F428FB}"
28+
EndProject
2729
Global
2830
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2931
Debug|Any CPU = Debug|Any CPU
@@ -58,6 +60,10 @@ Global
5860
{D97F476C-CD83-432E-AC15-077C91F78B79}.Debug|Any CPU.Build.0 = Debug|Any CPU
5961
{D97F476C-CD83-432E-AC15-077C91F78B79}.Release|Any CPU.ActiveCfg = Release|Any CPU
6062
{D97F476C-CD83-432E-AC15-077C91F78B79}.Release|Any CPU.Build.0 = Release|Any CPU
63+
{3E9F1A73-41EC-474C-A07C-DA0DD3F428FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64+
{3E9F1A73-41EC-474C-A07C-DA0DD3F428FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
65+
{3E9F1A73-41EC-474C-A07C-DA0DD3F428FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
66+
{3E9F1A73-41EC-474C-A07C-DA0DD3F428FB}.Release|Any CPU.Build.0 = Release|Any CPU
6167
EndGlobalSection
6268
GlobalSection(SolutionProperties) = preSolution
6369
HideSolutionNode = FALSE
@@ -70,6 +76,7 @@ Global
7076
{93DB1A95-88E1-4B5C-909B-012D64350251} = {A0F6C07F-188D-4F86-B43F-4A3EAD0D2C30}
7177
{19DF053D-2D66-4502-A5C2-341EF981D0C0} = {A0F6C07F-188D-4F86-B43F-4A3EAD0D2C30}
7278
{D97F476C-CD83-432E-AC15-077C91F78B79} = {A0F6C07F-188D-4F86-B43F-4A3EAD0D2C30}
79+
{3E9F1A73-41EC-474C-A07C-DA0DD3F428FB} = {A0F6C07F-188D-4F86-B43F-4A3EAD0D2C30}
7380
EndGlobalSection
7481
GlobalSection(ExtensibilityGlobals) = postSolution
7582
SolutionGuid = {269BE43F-2664-4A83-931C-2EC5E886B8AB}

src/AngularClient/Properties/launchSettings.json

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "https://localhost:44311/",
7-
"sslPort": 44311
8-
}
9-
},
2+
//"iisSettings": {
3+
// "windowsAuthentication": false,
4+
// "anonymousAuthentication": true,
5+
// "iisExpress": {
6+
// "applicationUrl": "http://localhost:59819",
7+
// "sslPort": 44383
8+
// }
9+
//},
1010
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
11+
//"IIS Express": {
12+
// "commandName": "IISExpress",
13+
// "launchBrowser": true,
14+
// "environmentVariables": {
15+
// "ASPNETCORE_ENVIRONMENT": "Development"
16+
// }
17+
//},
18+
"AngularClient1": {
19+
"commandName": "Project",
1320
"launchBrowser": true,
14-
"environmentVariables": {
15-
"ASPNETCORE_ENVIRONMENT": "Development"
16-
}
17-
},
18-
"web": {
19-
"commandName": "web",
21+
"applicationUrl": "https://localhost:44311;http://localhost:43412",
2022
"environmentVariables": {
2123
"ASPNETCORE_ENVIRONMENT": "Development"
2224
}

src/StsServerIdentity/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static int Main(string[] args)
3838
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
3939
WebHost.CreateDefaultBuilder(args)
4040
.UseStartup<Startup>()
41-
.UseKestrel(c => c.AddServerHeader = false)
41+
//.UseKestrel(c => c.AddServerHeader = false)
4242
.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
4343
.ReadFrom.Configuration(hostingContext.Configuration)
4444
.MinimumLevel.Debug()
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,12 @@
11
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "https://localhost:44318/",
7-
"sslPort": 44318
8-
}
9-
},
102
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
13-
"launchBrowser": true,
14-
"environmentVariables": {
15-
"ASPNETCORE_ENVIRONMENT": "Development"
16-
}
17-
},
183
"StsServerIdentity": {
194
"commandName": "Project",
205
"launchBrowser": true,
21-
"launchUrl": "http://localhost:5000",
6+
"applicationUrl": "https://localhost:44318;http://localhost:44319",
227
"environmentVariables": {
238
"ASPNETCORE_ENVIRONMENT": "Development"
249
}
25-
},
26-
"newProfile1": {
27-
"commandName": "IISExpress",
28-
"launchBrowser": true
2910
}
3011
}
3112
}

src/StsServerIdentity/Startup.cs

+47-54
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,6 @@ public void ConfigureServices(IServiceCollection services)
5555
services.AddSingleton<LocService>();
5656
services.AddLocalization(options => options.ResourcesPath = "Resources");
5757

58-
services.AddAuthentication()
59-
.AddOpenIdConnect("aad", "Login with Azure AD", options =>
60-
{
61-
options.Authority = $"https://login.microsoftonline.com/common";
62-
options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = false };
63-
options.ClientId = "99eb0b9d-ca40-476e-b5ac-6f4c32bfb530";
64-
options.CallbackPath = "/signin-oidc";
65-
});
66-
6758
services.AddIdentity<ApplicationUser, IdentityRole>()
6859
.AddEntityFrameworkStores<ApplicationDbContext>()
6960
.AddErrorDescriber<StsIdentityErrorDescriber>()
@@ -131,51 +122,53 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
131122
}
132123

133124
app.UseHsts(hsts => hsts.MaxAge(365).IncludeSubdomains());
134-
app.UseXContentTypeOptions();
135-
app.UseReferrerPolicy(opts => opts.NoReferrer());
136-
app.UseXXssProtection(options => options.EnabledWithBlockMode());
137-
138-
var stsConfig = Configuration.GetSection("StsConfig");
139-
var angularClientIdTokenOnlyUrl = stsConfig["AngularClientIdTokenOnlyUrl"];
140-
var angularClientUrl = stsConfig["AngularClientUrl"];
141-
142-
app.UseCsp(opts => opts
143-
.BlockAllMixedContent()
144-
.StyleSources(s => s.Self())
145-
.StyleSources(s => s.UnsafeInline())
146-
.FontSources(s => s.Self())
147-
.FrameAncestors(s => s.Self())
148-
.FrameAncestors(s => s.CustomSources(
149-
angularClientUrl, angularClientIdTokenOnlyUrl, "https://localhost:44352", "https://localhost:4200")
150-
)
151-
.ImageSources(imageSrc => imageSrc.Self())
152-
.ImageSources(imageSrc => imageSrc.CustomSources("data:"))
153-
.ScriptSources(s => s.Self())
154-
.ScriptSources(s => s.UnsafeInline())
155-
);
156-
157-
var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
158-
app.UseRequestLocalization(locOptions.Value);
159-
160-
app.UseStaticFiles(new StaticFileOptions()
161-
{
162-
OnPrepareResponse = context =>
163-
{
164-
if (context.Context.Response.Headers["feature-policy"].Count == 0)
165-
{
166-
var featurePolicy = "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'";
167-
168-
context.Context.Response.Headers["feature-policy"] = featurePolicy;
169-
}
170-
171-
if (context.Context.Response.Headers["X-Content-Security-Policy"].Count == 0)
172-
{
173-
var csp = "script-src 'self';style-src 'self';img-src 'self' data:;font-src 'self';form-action 'self';frame-ancestors 'self';block-all-mixed-content";
174-
// IE
175-
context.Context.Response.Headers["X-Content-Security-Policy"] = csp;
176-
}
177-
}
178-
});
125+
//app.UseXContentTypeOptions();
126+
//app.UseReferrerPolicy(opts => opts.NoReferrer());
127+
//app.UseXXssProtection(options => options.EnabledWithBlockMode());
128+
129+
//var stsConfig = Configuration.GetSection("StsConfig");
130+
//var angularClientIdTokenOnlyUrl = stsConfig["AngularClientIdTokenOnlyUrl"];
131+
//var angularClientUrl = stsConfig["AngularClientUrl"];
132+
133+
//app.UseCsp(opts => opts
134+
// .BlockAllMixedContent()
135+
// .StyleSources(s => s.Self())
136+
// .StyleSources(s => s.UnsafeInline())
137+
// .FontSources(s => s.Self())
138+
// .FrameAncestors(s => s.Self())
139+
// .FrameAncestors(s => s.CustomSources(
140+
// angularClientUrl, angularClientIdTokenOnlyUrl, "https://localhost:44352", "https://localhost:4200")
141+
// )
142+
// .ImageSources(imageSrc => imageSrc.Self())
143+
// .ImageSources(imageSrc => imageSrc.CustomSources("data:"))
144+
// .ScriptSources(s => s.Self())
145+
// .ScriptSources(s => s.UnsafeInline())
146+
//);
147+
148+
//var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
149+
//app.UseRequestLocalization(locOptions.Value);
150+
151+
app.UseStaticFiles(
152+
// new StaticFileOptions()
153+
//{
154+
// OnPrepareResponse = context =>
155+
// {
156+
// if (context.Context.Response.Headers["feature-policy"].Count == 0)
157+
// {
158+
// var featurePolicy = "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'";
159+
160+
// context.Context.Response.Headers["feature-policy"] = featurePolicy;
161+
// }
162+
163+
// if (context.Context.Response.Headers["X-Content-Security-Policy"].Count == 0)
164+
// {
165+
// var csp = "script-src 'self';style-src 'self';img-src 'self' data:;font-src 'self';form-action 'self';frame-ancestors 'self';block-all-mixed-content";
166+
// // IE
167+
// context.Context.Response.Headers["X-Content-Security-Policy"] = csp;
168+
// }
169+
// }
170+
//}
171+
);
179172
app.UseIdentityServer();
180173

181174
app.UseMvc(routes =>

src/StsServerIdentity/StsServerIdentity.csproj

-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
<ItemGroup>
2525
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
2626
</ItemGroup>
27-
28-
<ItemGroup>
29-
<None Update="sts_dev_cert.pfx">
30-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31-
</None>
32-
</ItemGroup>
3327

3428
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('node_modules') ">
3529
<!-- Ensure Node.js is installed -->
-2.51 KB
Binary file not shown.

src/StsServerIdentity/runtimeconfig.template.json

-5
This file was deleted.
-2.62 KB
Binary file not shown.
-104 KB
Binary file not shown.

src/StsServerIdentity/web.config

-19
This file was deleted.

0 commit comments

Comments
 (0)