@@ -55,15 +55,6 @@ public void ConfigureServices(IServiceCollection services)
55
55
services . AddSingleton < LocService > ( ) ;
56
56
services . AddLocalization ( options => options . ResourcesPath = "Resources" ) ;
57
57
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
-
67
58
services . AddIdentity < ApplicationUser , IdentityRole > ( )
68
59
. AddEntityFrameworkStores < ApplicationDbContext > ( )
69
60
. AddErrorDescriber < StsIdentityErrorDescriber > ( )
@@ -131,51 +122,53 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
131
122
}
132
123
133
124
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
+ ) ;
179
172
app . UseIdentityServer ( ) ;
180
173
181
174
app . UseMvc ( routes =>
0 commit comments