|
@@ -1,6 +1,7 @@
|
1
|
1
|
using AutoMapper;
|
2
|
2
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
3
|
3
|
using Microsoft.AspNetCore.Builder;
|
|
4
|
+using Microsoft.AspNetCore.Cors.Infrastructure;
|
4
|
5
|
using Microsoft.AspNetCore.Hosting;
|
5
|
6
|
using Microsoft.AspNetCore.Mvc;
|
6
|
7
|
using Microsoft.AspNetCore.Mvc.Cors.Internal;
|
|
@@ -38,7 +39,7 @@ using UnivateProperties_API.Repository.Users;
|
38
|
39
|
namespace UnivateProperties_API
|
39
|
40
|
{
|
40
|
41
|
public class Startup
|
41
|
|
- {
|
|
42
|
+ {
|
42
|
43
|
public Startup(IConfiguration configuration)
|
43
|
44
|
{
|
44
|
45
|
Configuration = configuration;
|
|
@@ -47,13 +48,13 @@ namespace UnivateProperties_API
|
47
|
48
|
public IConfiguration Configuration { get; }
|
48
|
49
|
|
49
|
50
|
public void ConfigureServices(IServiceCollection services)
|
50
|
|
- {
|
|
51
|
+ {
|
51
|
52
|
services.AddAutoMapper();
|
52
|
53
|
services.AddCors(o => o.AddPolicy("MyPolicy", builder =>
|
53
|
54
|
{
|
54
|
55
|
builder.AllowAnyOrigin()
|
55
|
56
|
.AllowAnyMethod()
|
56
|
|
- .AllowAnyHeader();
|
|
57
|
+ .AllowAnyHeader();
|
57
|
58
|
}));
|
58
|
59
|
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
59
|
60
|
services.AddDbContext<DataContext>(o => o.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
|
|
@@ -98,6 +99,11 @@ namespace UnivateProperties_API
|
98
|
99
|
};
|
99
|
100
|
});
|
100
|
101
|
|
|
102
|
+ services.Configure<IISServerOptions>(options =>
|
|
103
|
+ {
|
|
104
|
+ options.AutomaticAuthentication = true;
|
|
105
|
+ });
|
|
106
|
+
|
101
|
107
|
#region ProcessFlow
|
102
|
108
|
services.AddTransient<IBidRepository, BidRepository>();
|
103
|
109
|
#endregion
|
|
@@ -156,7 +162,7 @@ namespace UnivateProperties_API
|
156
|
162
|
#endregion
|
157
|
163
|
services.Configure<MvcOptions>(options =>
|
158
|
164
|
{
|
159
|
|
- options.Filters.Add(new CorsAuthorizationFilterFactory("MyPolicy"));
|
|
165
|
+ options.Filters.Add(new CorsAuthorizationFilterFactory("MyPolicy"));
|
160
|
166
|
});
|
161
|
167
|
}
|
162
|
168
|
|
|
@@ -170,7 +176,7 @@ namespace UnivateProperties_API
|
170
|
176
|
app.UseCors(x => x
|
171
|
177
|
.AllowAnyOrigin()
|
172
|
178
|
.AllowAnyMethod()
|
173
|
|
- .AllowAnyHeader());
|
|
179
|
+ .AllowAnyHeader());
|
174
|
180
|
app.UseAuthentication();
|
175
|
181
|
app.UseHttpsRedirection();
|
176
|
182
|
app.UseMvc();
|
|
@@ -187,6 +193,6 @@ namespace UnivateProperties_API
|
187
|
193
|
//context.Database.Migrate();
|
188
|
194
|
}
|
189
|
195
|
}
|
190
|
|
- }
|
|
196
|
+ }
|
191
|
197
|
}
|
192
|
198
|
}
|