12
12
using Microsoft . Extensions . Configuration ;
13
13
using Microsoft . Extensions . DependencyInjection ;
14
14
using Microsoft . IdentityModel . Tokens ;
15
+ using SqlKata . Execution ;
15
16
using Swashbuckle . AspNetCore . Swagger ;
17
+ using MySql . Data . MySqlClient ;
18
+ using SqlKata . Compilers ;
19
+
16
20
public class Startup
17
21
{
18
22
private const string _defaultCorsPolicyName = "localhost" ;
@@ -26,8 +30,7 @@ public Startup(IConfiguration configuration)
26
30
// This method gets called by the runtime. Use this method to add services to the container.
27
31
public void ConfigureServices ( IServiceCollection services )
28
32
{
29
-
30
-
33
+
31
34
services . Configure < List < Role > > ( Configuration . GetSection ( "RoleList" ) ) ;
32
35
services . Configure < Dictionary < string , string > > ( Configuration . GetSection ( "tablempper" ) ) ;
33
36
services . Configure < TokenAuthConfiguration > ( tokenAuthConfig =>
@@ -40,9 +43,11 @@ public void ConfigureServices(IServiceCollection services)
40
43
} ) ;
41
44
AuthConfigurer . Configure ( services , Configuration ) ;
42
45
43
- services . AddCors ( options => options . AddPolicy ( _defaultCorsPolicyName , builder => builder . AllowAnyOrigin ( )
46
+ services . AddCors ( options => options . AddPolicy ( _defaultCorsPolicyName ,
47
+ builder =>
48
+ builder . AllowAnyOrigin ( )
44
49
. AllowAnyHeader ( )
45
- . AllowAnyMethod ( )
50
+ . AllowAnyMethod ( ) . AllowCredentials ( )
46
51
) ) ;
47
52
services . AddMvc ( ) . SetCompatibilityVersion ( CompatibilityVersion . Version_2_1 ) ;
48
53
services . AddSwaggerGen ( c =>
@@ -55,12 +60,15 @@ public void ConfigureServices(IServiceCollection services)
55
60
services . AddSingleton < IHttpContextAccessor , HttpContextAccessor > ( ) ;
56
61
services . AddTransient < IIdentityService , IdentityService > ( ) ;
57
62
services . AddTransient < ITableMapper , TableMapper > ( ) ;
63
+
58
64
}
59
65
60
66
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
61
67
public void Configure ( IApplicationBuilder app , IHostingEnvironment env )
62
68
{
69
+
63
70
app . UseAuthentication ( ) ;
71
+
64
72
app . UseMvc ( routes =>
65
73
{
66
74
routes . MapRoute (
0 commit comments