From c9717c8af80a511114420c303d00af86b0a68f82 Mon Sep 17 00:00:00 2001 From: VANNEAU Date: Fri, 10 Dec 2021 16:12:26 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9but=20de=20upgrade=20version=20et=20dock?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++++ EPAServeur.Tests/EPAServeur.Tests.csproj | 12 +++++------ EPAServeur/ClientCollaborateur/ApiClient.cs | 2 +- EPAServeur/Commun/APIAccess.cs | 2 +- EPAServeur/Commun/BDaccess.cs | 4 ++-- EPAServeur/Commun/KeycloakAuthentificator.cs | 2 +- EPAServeur/EPAServeur.csproj | 22 ++++++++++---------- EPAServeur/Program.cs | 1 + EPAServeur/Properties/launchSettings.json | 9 +++++--- EPAServeur/Startup.cs | 22 ++++++++++++-------- EPAServeur/appsettings.json | 9 +++++--- 11 files changed, 52 insertions(+), 37 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f47e54f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0 +COPY EPAServeur/bin/Release/net6.0/publish/ App/ +WORKDIR /App +ENTRYPOINT ["dotnet", "EPAServeur.dll"] \ No newline at end of file diff --git a/EPAServeur.Tests/EPAServeur.Tests.csproj b/EPAServeur.Tests/EPAServeur.Tests.csproj index 5aabbe5..3e9fd02 100644 --- a/EPAServeur.Tests/EPAServeur.Tests.csproj +++ b/EPAServeur.Tests/EPAServeur.Tests.csproj @@ -1,20 +1,20 @@  - netcoreapp3.1 + net6.0 false - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + diff --git a/EPAServeur/ClientCollaborateur/ApiClient.cs b/EPAServeur/ClientCollaborateur/ApiClient.cs index 09dc3d6..8a62db9 100644 --- a/EPAServeur/ClientCollaborateur/ApiClient.cs +++ b/EPAServeur/ClientCollaborateur/ApiClient.cs @@ -203,7 +203,7 @@ namespace IO.Swagger.ClientCollaborateur path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); InterceptRequest(request); - var response = await RestClient.ExecuteTaskAsync(request); + var response = await RestClient.ExecuteAsync(request); //var response = await RestClient.ExecuteAsync(request); InterceptResponse(request, response); return (Object)response; diff --git a/EPAServeur/Commun/APIAccess.cs b/EPAServeur/Commun/APIAccess.cs index c5d479b..ddf723b 100644 --- a/EPAServeur/Commun/APIAccess.cs +++ b/EPAServeur/Commun/APIAccess.cs @@ -12,7 +12,7 @@ namespace EPAServeur.BDAccess public class APIAccess { private static APIAccess instance = null; - private string serveur = "http://localhost:3000"; + private string serveur = "http://www.epa.apside.com/api"; private APIAccess() { diff --git a/EPAServeur/Commun/BDaccess.cs b/EPAServeur/Commun/BDaccess.cs index eaee2a2..4554296 100644 --- a/EPAServeur/Commun/BDaccess.cs +++ b/EPAServeur/Commun/BDaccess.cs @@ -16,9 +16,9 @@ namespace EPAServeur.BDAccess { MySqlConnectionStringBuilder infoConnection = new MySqlConnectionStringBuilder() { - Server = "localhost", + Server = "digitepa_db", Port = 3306, - Database = "evaluationprofessionelle", + Database = "database_ep", UserID = "dev", Password = "dev" }; diff --git a/EPAServeur/Commun/KeycloakAuthentificator.cs b/EPAServeur/Commun/KeycloakAuthentificator.cs index 127d85c..a2d6a3b 100644 --- a/EPAServeur/Commun/KeycloakAuthentificator.cs +++ b/EPAServeur/Commun/KeycloakAuthentificator.cs @@ -10,7 +10,7 @@ namespace EPAServeur.Commun { public class KeycloakAuthentificator { - private static readonly string host = "http://localhost:8080/auth/realms/master/protocol/openid-connect/userinfo"; + private static readonly string host = "http://www.epa.apside.com/auth/realms/master/protocol/openid-connect/userinfo"; public static bool IsvalidToken(string token) { List> param = new List>(); diff --git a/EPAServeur/EPAServeur.csproj b/EPAServeur/EPAServeur.csproj index a72dab4..8cb128f 100644 --- a/EPAServeur/EPAServeur.csproj +++ b/EPAServeur/EPAServeur.csproj @@ -1,22 +1,22 @@  - netcoreapp3.1 + net6.0 Debug;Release;InitDB - - - - - - + + + + + + - - - - + + + + diff --git a/EPAServeur/Program.cs b/EPAServeur/Program.cs index 65abc7a..56d676f 100644 --- a/EPAServeur/Program.cs +++ b/EPAServeur/Program.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; diff --git a/EPAServeur/Properties/launchSettings.json b/EPAServeur/Properties/launchSettings.json index cc014d0..b902850 100644 --- a/EPAServeur/Properties/launchSettings.json +++ b/EPAServeur/Properties/launchSettings.json @@ -1,4 +1,4 @@ -{ +{ "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, @@ -11,11 +11,14 @@ "profiles": { "IIS Express": { "commandName": "IISExpress", - "launchBrowser": false, "launchUrl": "api/", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "" } } -} +} \ No newline at end of file diff --git a/EPAServeur/Startup.cs b/EPAServeur/Startup.cs index 02ec8d6..3bb97aa 100644 --- a/EPAServeur/Startup.cs +++ b/EPAServeur/Startup.cs @@ -38,7 +38,8 @@ namespace EPAServeur options.AddPolicy(name: AllowCrossClientEPA, builder => { - builder.WithOrigins("http://localhost:4200").AllowAnyHeader().AllowAnyMethod(); + builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();//WithOrigins("http://digitepa_proxy/").AllowAnyHeader().AllowAnyMethod(); + }); }); @@ -53,6 +54,8 @@ namespace EPAServeur { o.Authority = Configuration["Jwt:Authority"]; o.Audience = Configuration["Jwt:Audience"]; + o.TokenValidationParameters.ValidateIssuer = false; + //o.TokenValidationParameters.ValidIssuers = Configuration.GetSection("Jwt:ValidIssuers").Get(); if (Environment.IsDevelopment()) { @@ -95,15 +98,16 @@ namespace EPAServeur services.AddDbContext(b => b.UseMySQL(Configuration["Data:DefaultConnection:ConnectionString"])); - var optionBuider = new DbContextOptionsBuilder() - .UseMySQL(Configuration["Data:DefaultConnection:ConnectionString"]) + /*var optionBuider = new DbContextOptionsBuilder() + //.UseMySQL(Configuration["Data:DefaultConnection:ConnectionString"]) + .UseMySQL("server=localhost;database=server_ep;user=root;password=root") .Options; - using (var context = new EpContext(optionBuider)) - { - context.Database.EnsureDeleted(); //PENSEZ A ENLEVER CETTE LIGNE ET A NE JAMAIS LA REMETTRE QUAND LE SERVEUR SERA MIS EN PRODUCTION ^^ - context.Database.EnsureCreated(); - context.SaveChanges(); + using (var context = new EpContext(optionBuider)) { };*/ + /*{ + //context.Database.EnsureDeleted(); //PENSEZ A ENLEVER CETTE LIGNE ET A NE JAMAIS LA REMETTRE QUAND LE SERVEUR SERA MIS EN PRODUCTION ^^ + //context.Database.EnsureCreated(); + //context.SaveChanges(); DataSeeder.AddInformationsDeBase(context); DataSeeder.AddChamps(context); @@ -112,7 +116,7 @@ namespace EPAServeur DataSeeder.AddEngagements(context); DataSeeder.AddEp(context); DataSeeder.AddRereferentEP(context); - } + }*/ //faire using, check si kekchoz exkist puis appeler les m�thodes de cr�ation si il n'y a rien //API Collaborateurs diff --git a/EPAServeur/appsettings.json b/EPAServeur/appsettings.json index 10ef20c..f4ed1e3 100644 --- a/EPAServeur/appsettings.json +++ b/EPAServeur/appsettings.json @@ -1,11 +1,14 @@ { "Jwt": { - "Authority": "http://localhost:8080/auth/realms/Apside", - "Audience": "account" + "Authority": "https://digitepa_proxy/auth/realms/Apside", + "Audience": "account", + "ValidIssuers": [ + "https://digitepa_proxy/auth/realms/Apside" + ] }, "Data": { "DefaultConnection": { - "ConnectionString": "server=localhost;database=server_ep;user=root;password=root" + "ConnectionString": "server=digitepa_db;database=database_ep;user=dev;password=dev" } }, "Logging": {