7
7
using Microsoft . AspNetCore . Hosting ;
8
8
using Microsoft . AspNetCore . Http ;
9
9
using Microsoft . AspNetCore . Localization ;
10
- using Microsoft . AspNetCore . Mvc ;
11
10
using Microsoft . EntityFrameworkCore ;
12
11
using Microsoft . Extensions . Configuration ;
13
12
using Microsoft . Extensions . DependencyInjection ;
14
13
using Microsoft . Extensions . FileProviders ;
14
+ using Microsoft . Extensions . Hosting ;
15
15
using Microsoft . Net . Http . Headers ;
16
16
17
17
using SameSiteMode = Microsoft . AspNetCore . Http . SameSiteMode ;
@@ -92,6 +92,8 @@ public void ConfigureServices(IServiceCollection services) {
92
92
opts . AddPolicy ( CorsPolicyCodeMooc , builder => {
93
93
builder . WithOrigins ( "https://*.codemooc.net" )
94
94
. SetIsOriginAllowedToAllowWildcardSubdomains ( )
95
+ . AllowAnyMethod ( )
96
+ . AllowCredentials ( )
95
97
. WithHeaders ( HeaderNames . Authorization ) ;
96
98
} ) ;
97
99
} ) ;
@@ -115,7 +117,7 @@ public void ConfigureServices(IServiceCollection services) {
115
117
} ) ;
116
118
}
117
119
118
- public void Configure ( IApplicationBuilder app , IHostingEnvironment env ) {
120
+ public void Configure ( IApplicationBuilder app , IWebHostEnvironment env ) {
119
121
if ( env . IsDevelopment ( ) ) {
120
122
app . UseDeveloperExceptionPage ( ) ;
121
123
}
@@ -155,9 +157,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
155
157
RequestPath = "/uploads/profiles"
156
158
} ) ;
157
159
160
+ app . UseCors ( CorsPolicyCodeMooc ) ;
161
+
158
162
app . UseAuthentication ( ) ;
159
163
app . UseAuthorization ( ) ;
160
- app . UseCors ( CorsPolicyCodeMooc ) ;
161
164
162
165
app . UseEndpoints ( conf => {
163
166
conf . MapControllers ( ) ;
0 commit comments