From 1a153ef4be095b693c14128b3f74fe347ef295cb Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 15 Nov 2022 16:23:40 +0100 Subject: [PATCH 1/7] Update (quasi) completo x gestione sessione utente --- MP.Data/DTO/OperatoreDTO.cs | 19 ++ MP.INVE/Components/CmpTop.razor | 1 + MP.INVE/Components/CmpTop.razor.cs | 50 +++++- MP.INVE/Data/LoginService.cs | 247 ++++++++++++++++++++++++++ MP.INVE/Data/MessageService.cs | 2 +- MP.INVE/Data/MpDataService.cs | 32 ++-- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/OperatoreLogin.razor | 12 +- MP.INVE/Pages/OperatoreLogin.razor.cs | 28 ++- MP.INVE/Program.cs | 2 + MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 13 files changed, 363 insertions(+), 38 deletions(-) create mode 100644 MP.Data/DTO/OperatoreDTO.cs create mode 100644 MP.INVE/Data/LoginService.cs diff --git a/MP.Data/DTO/OperatoreDTO.cs b/MP.Data/DTO/OperatoreDTO.cs new file mode 100644 index 00000000..62f6e001 --- /dev/null +++ b/MP.Data/DTO/OperatoreDTO.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data.DTO +{ + public class OperatoreDTO + { + public int MatrOpr { get; set; } = 0; + public string Cognome { get; set; } = ""; + public string Nome { get; set; } = ""; + public bool isAdmin { get; set; } = false; + public string authKey { get; set; } = ""; + public string CodOprExt { get; set; } = ""; + public string userJWT { get; set; } = ""; + } +} diff --git a/MP.INVE/Components/CmpTop.razor b/MP.INVE/Components/CmpTop.razor index c2578ed2..214509c9 100644 --- a/MP.INVE/Components/CmpTop.razor +++ b/MP.INVE/Components/CmpTop.razor @@ -7,6 +7,7 @@
+ @userName
diff --git a/MP.INVE/Components/CmpTop.razor.cs b/MP.INVE/Components/CmpTop.razor.cs index 0fc621ce..88979cd7 100644 --- a/MP.INVE/Components/CmpTop.razor.cs +++ b/MP.INVE/Components/CmpTop.razor.cs @@ -1,11 +1,12 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.Extensions.Configuration; using Microsoft.JSInterop; using MP.INVE.Data; namespace MP.INVE.Components { - public partial class CmpTop + public partial class CmpTop:IDisposable { #region Public Methods @@ -17,6 +18,13 @@ namespace MP.INVE.Components NavManager.NavigateTo(NavManager.Uri, true); } + public void Dispose() + { + LServ.EA_LogIn -= LServ_EA_LogIn; + LServ.EA_LogOut -= LServ_EA_LogOut; + GC.Collect(); + } + #endregion Public Methods #region Protected Properties @@ -24,20 +32,34 @@ namespace MP.INVE.Components [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + protected LoginService LServ { get; set; } = null!; + #endregion Protected Properties #region Protected Methods protected override async Task OnInitializedAsync() { + LServ.EA_LogIn += LServ_EA_LogIn; + LServ.EA_LogOut += LServ_EA_LogOut; await forceReload(); } + private void LServ_EA_LogOut() + { + NavManager.NavigateTo("OperatoreLogin", true); + } + + private void LServ_EA_LogIn() + { + NavManager.NavigateTo("Starter", true); + } + #endregion Protected Methods #region Private Fields - private string userName = ""; #endregion Private Fields @@ -54,15 +76,27 @@ namespace MP.INVE.Components private async Task forceReload() { - var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); - var user = authState.User; - if (user.Identity != null && user.Identity.IsAuthenticated) + await Task.Delay(1); + // controllo per login + if (LServ.matrOpr <= 0 && !NavManager.Uri.Contains("OperatoreLogin")) { - userName = $"{user.Identity.Name}"; + NavManager.NavigateTo("OperatoreLogin", true); } - else + } + + private async Task logOut() + { + await Task.Delay(1); + LServ.LogOut(); + } + + private string userName + { + get { - userName = "N.A."; + string answ = "ND"; + answ = $"{LServ.Cognome} {LServ.Cognome} ({LServ.matrOpr})"; + return answ; } } diff --git a/MP.INVE/Data/LoginService.cs b/MP.INVE/Data/LoginService.cs new file mode 100644 index 00000000..b76a8741 --- /dev/null +++ b/MP.INVE/Data/LoginService.cs @@ -0,0 +1,247 @@ +using MP.Data.DTO; +using Newtonsoft.Json; +using NLog; +using StackExchange.Redis; +using System.Diagnostics; + +namespace MP.INVE.Data +{ + public class LoginService : IDisposable + { + #region Public Constructors + + public LoginService(IConfiguration configuration, ILogger logger, HttpClient httpClient, + IHttpContextAccessor httpContextAccessor) + { + this.HttpClient = httpClient; + HttpContextAccessor = httpContextAccessor; + + _logger = logger; + _logger.LogInformation("Starting LoginService INIT"); + _configuration = configuration; + + // setup compoenti REDIS + redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); + redisConnAdmin = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("RedisAdmin")); + redisDb = redisConn.GetDatabase(); + + // leggo cache lungo periodo + int.TryParse(_configuration.GetValue("ServerConf:redisLongTimeCache"), out redisLongTimeCache); + + _logger.LogInformation("Redis LoginService INIT"); + } + + #endregion Public Constructors + + #region Public Events + + public event Action EA_LogIn = null!; + + public event Action EA_LogOut = null!; + + #endregion Public Events + + #region Public Properties + + public string Cognome + { + get + { + string answ = "NA"; + if (matrOpr > 0 && !string.IsNullOrEmpty(authKey)) + { + var currUser = UserDTO(matrOpr, authKey); + if (currUser != null) + { + answ = currUser.Cognome; + } + } + return answ; + } + } + + public int matrOpr + { + get + { + int answ = 0; + if (HttpContextAccessor.HttpContext != null) + { + var token = HttpContextAccessor.HttpContext.Request.Cookies["userId_token"]; + if (token != null) + { + int.TryParse(token, out answ); + } + } + return answ; + } + set + { + CookieOptions options = new CookieOptions(); + options.Expires = DateTime.Now.AddDays(1); + if (HttpContextAccessor.HttpContext != null) + { + HttpContextAccessor.HttpContext.Response.Cookies.Append("userId_token", $"{value}", options); + } + } + } + + public string Nome + { + get + { + string answ = "NA"; + if (matrOpr > 0 && !string.IsNullOrEmpty(authKey)) + { + var currUser = UserDTO(matrOpr, authKey); + if (currUser != null) + { + answ = currUser.Nome; + } + } + return answ; + } + } + + #endregion Public Properties + + #region Public Methods + + public void Dispose() + { + } + + public void LogOut() + { + OperatoreDTO resetData = new OperatoreDTO(); + UserDTOSave(resetData); + } + + /// + /// Ricerca su REDIS dell'utente loggato + /// NB: da rifare con unico JWT che contenga tutto + /// + /// + /// + /// + public OperatoreDTO? UserDTO(int matrOpr, string authKey) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + OperatoreDTO? result = null; + string source = "REDIS"; + // cerco in redis... + RedisValue rawData = redisDb.StringGet($"{redisUserSession}:{matrOpr}"); + if (!string.IsNullOrEmpty($"{rawData}")) + { + try + { + result = JsonConvert.DeserializeObject($"{rawData}"); + } + catch + { } + } +#if false + else + { + result = await Task.FromResult(dbController.AnagStatiComm()); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(redisUserSession, rawData, getRandTOut(redisLongTimeCache)); + source = "DB"; + } +#endif + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"LoggedUser Read from {source}: {ts.TotalMilliseconds}ms"); + // restituisco + return result; + } + + /// + /// Salva su REDIS dati dell'utente loggato + /// + /// + public bool UserDTOSave(OperatoreDTO userData) + { + bool fatto = false; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string source = "REDIS"; + // cerco in redis... + string rawData = JsonConvert.SerializeObject(userData); + fatto = redisDb.StringSet($"{redisUserSession}:{userData.MatrOpr}", rawData, TimeSpan.FromMinutes(60)); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"UserDTO write to {source}: {ts.TotalMilliseconds}ms"); + // restituisco + return fatto; + } + + #endregion Public Methods + + #region Protected Properties + + protected string authKey + { + get + { + string answ = ""; + if (HttpContextAccessor.HttpContext != null) + { + var token = HttpContextAccessor.HttpContext.Request.Cookies["authKey_token"]; + if (token != null) + { + answ = token; + } + } + return answ; + } + set + { + CookieOptions options = new CookieOptions(); + options.Expires = DateTime.Now.AddDays(1); + + if (HttpContextAccessor.HttpContext != null) + { + HttpContextAccessor.HttpContext.Response.Cookies.Append("authKey_token", value, options); + } + } + } + + protected HttpClient HttpClient { get; set; } + protected IHttpContextAccessor HttpContextAccessor { get; set; } + + #endregion Protected Properties + + #region Private Fields + + private const string redisBaseAddr = "MP:INVE"; + + private const string redisUserSession = redisBaseAddr + ":User:"; + private static IConfiguration _configuration = null!; + + private static ILogger _logger = null!; + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + /// + /// Oggetto per connessione a REDIS + /// + private ConnectionMultiplexer redisConn = null!; + + /// + /// Oggetto per connessione a REDIS modalità admin (ex flux dati) + /// + private ConnectionMultiplexer redisConnAdmin = null!; + + /// + /// Oggetto DB redis da impiegare x chiamate R/W + /// + private IDatabase redisDb = null!; + + private int redisLongTimeCache = 5; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/MP.INVE/Data/MessageService.cs b/MP.INVE/Data/MessageService.cs index 99dc18df..985557d0 100644 --- a/MP.INVE/Data/MessageService.cs +++ b/MP.INVE/Data/MessageService.cs @@ -53,7 +53,7 @@ get => searchVal; set { - //if (searchVal != value) + //if (_nome != value) //{ searchVal = value; diff --git a/MP.INVE/Data/MpDataService.cs b/MP.INVE/Data/MpDataService.cs index 13c3ee36..e44df918 100644 --- a/MP.INVE/Data/MpDataService.cs +++ b/MP.INVE/Data/MpDataService.cs @@ -1090,37 +1090,37 @@ namespace MP.INVE.Data #region Private Fields - private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier"; + private const string redisArtByDossier = redisBaseAddr + ":Cache:ArtByDossier"; - private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList"; + private const string redisArtList = redisBaseAddr + ":Cache:ArtList"; - private const string redisBaseAddr = "MP:"; + private const string redisBaseAddr = "MP:SPEC"; - private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config"; + private const string redisConfKey = redisBaseAddr + ":Cache:Config"; - private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac"; + private const string redisDossByMac = redisBaseAddr + ":Cache:DossByMac"; - private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac"; + private const string redisFluxByMac = redisBaseAddr + ":Cache:FluxByMac"; - private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt"; + private const string redisFluxLogFilt = redisBaseAddr + ":Cache:FluxLogFilt"; - private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux"; + private const string redisMacByFlux = redisBaseAddr + ":Cache:MacByFlux"; - private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList"; + private const string redisMacList = redisBaseAddr + ":Cache:MacList"; - private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac"; + private const string redisOdlCurrByMac = redisBaseAddr + ":Cache:OdlByMac"; - private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList"; + private const string redisPOdlList = redisBaseAddr + ":Cache:POdlList"; - private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl"; + private const string redisPOdlByPOdl = redisBaseAddr + ":Cache:POdlByPOdl"; - private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl"; + private const string redisPOdlByOdl = redisBaseAddr + ":Cache:POdlByOdl"; - private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; + private const string redisStatoCom = redisBaseAddr + ":Cache:StatoCom"; - private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt"; + private const string redisTipoArt = redisBaseAddr + ":Cache:TipoArt"; - private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario"; + private const string redisVocabolario = redisBaseAddr + ":Cache:Vocabolario"; private static IConfiguration _configuration = null!; diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 5a0477f8..33483024 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2211.1510 + 6.16.2211.1516 diff --git a/MP.INVE/Pages/OperatoreLogin.razor b/MP.INVE/Pages/OperatoreLogin.razor index 73e37eab..20a76f37 100644 --- a/MP.INVE/Pages/OperatoreLogin.razor +++ b/MP.INVE/Pages/OperatoreLogin.razor @@ -3,23 +3,23 @@

OperatoreLogin

-
- - -
+
+ + +
- +
diff --git a/MP.INVE/Pages/OperatoreLogin.razor.cs b/MP.INVE/Pages/OperatoreLogin.razor.cs index e6b2a3a5..40220f62 100644 --- a/MP.INVE/Pages/OperatoreLogin.razor.cs +++ b/MP.INVE/Pages/OperatoreLogin.razor.cs @@ -16,6 +16,7 @@ using MP.INVE.Data; using MP.INVE.Shared; using MP.INVE.Components; using MP.Data.DatabaseModels; +using MP.Data.DTO; namespace MP.INVE.Pages { @@ -26,8 +27,11 @@ namespace MP.INVE.Pages [Inject] private NavigationManager NavManager { get; set; } = null!; - private int idOperatore { get; set; } - private string authKey { get; set; } + [Inject] + protected LoginService LServ { get; set; } = null!; + + private int idOperatore { get; set; } = 0; + private string authKey { get; set; } = ""; private List? elencoOperatori; @@ -44,12 +48,30 @@ namespace MP.INVE.Pages if (ok) { + // recupero operatore + var currOpr = elencoOperatori.Where(x => x.MatrOpr == idOperatore).FirstOrDefault(); + if (currOpr != null) + { + var oprDto = new OperatoreDTO() + { + authKey= currOpr.authKey, + CodOprExt= currOpr.CodOprExt, + Cognome= currOpr.Cognome, + isAdmin=currOpr.isAdmin, + userJWT="", + MatrOpr= currOpr.MatrOpr, + Nome= currOpr.Nome + }; + // salvo valori operatore + LServ.UserDTOSave(oprDto); + } + NavManager.NavigateTo("/Starter", true); } else { - } + } } } } \ No newline at end of file diff --git a/MP.INVE/Program.cs b/MP.INVE/Program.cs index ae34829e..ef779ba4 100644 --- a/MP.INVE/Program.cs +++ b/MP.INVE/Program.cs @@ -35,9 +35,11 @@ builder.Services.AddAuthorization(options => builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); +builder.Services.AddHttpContextAccessor(); builder.Services.AddSingleton(redisMultiplexer); builder.Services.AddSingleton(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddHttpClient(); builder.Services.AddSingleton(); diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 875b9e27..3c5ae6f3 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2211.1510

+

Versione: 6.16.2211.1516


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index bebf680a..2002665a 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.1510 +6.16.2211.1516 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index c0c8cbb8..9f89f9c7 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.1510 + 6.16.2211.1516 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false From b141f5cfa2ceabf9e4afbd6a189d0d520f69cea7 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 15 Nov 2022 17:39:04 +0100 Subject: [PATCH 2/7] minor fix --- MP.INVE/Data/LoginService.cs | 8 +++++ MP.INVE/Pages/OperatoreLogin.razor.cs | 2 +- MP.INVE/Pages/Starter.razor | 30 ------------------ MP.INVE/Pages/Starter.razor.cs | 45 +++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 31 deletions(-) create mode 100644 MP.INVE/Pages/Starter.razor.cs diff --git a/MP.INVE/Data/LoginService.cs b/MP.INVE/Data/LoginService.cs index b76a8741..dd08f946 100644 --- a/MP.INVE/Data/LoginService.cs +++ b/MP.INVE/Data/LoginService.cs @@ -67,10 +67,17 @@ namespace MP.INVE.Data int answ = 0; if (HttpContextAccessor.HttpContext != null) { +#if false var token = HttpContextAccessor.HttpContext.Request.Cookies["userId_token"]; if (token != null) { int.TryParse(token, out answ); + } +#endif + var currUser = UserDTO(matrOpr, authKey); + if (currUser != null) + { + answ = currUser.MatrOpr; } } return answ; @@ -167,6 +174,7 @@ namespace MP.INVE.Data bool fatto = false; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); + string source = "REDIS"; // cerco in redis... string rawData = JsonConvert.SerializeObject(userData); diff --git a/MP.INVE/Pages/OperatoreLogin.razor.cs b/MP.INVE/Pages/OperatoreLogin.razor.cs index 40220f62..1aaee477 100644 --- a/MP.INVE/Pages/OperatoreLogin.razor.cs +++ b/MP.INVE/Pages/OperatoreLogin.razor.cs @@ -66,7 +66,7 @@ namespace MP.INVE.Pages LServ.UserDTOSave(oprDto); } - NavManager.NavigateTo("/Starter", true); + NavManager.NavigateTo("Starter", true); } else { diff --git a/MP.INVE/Pages/Starter.razor b/MP.INVE/Pages/Starter.razor index 47b44abf..1f41fc74 100644 --- a/MP.INVE/Pages/Starter.razor +++ b/MP.INVE/Pages/Starter.razor @@ -9,34 +9,4 @@ @**@ -@code { - [Inject] - private IConfiguration Configuration { get; set; } = null!; - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); - } - } - - protected string BaseUrlTab - { - get => $"{Configuration["ServerConf:BaseUrl"]}"; - } - - - protected string rawCode - { - get - { - string answ = ""; - answ = $"{BaseUrlTab}MatrOpr={101}&UserAuthKey={12345}"; - return answ; - } - } - - -} diff --git a/MP.INVE/Pages/Starter.razor.cs b/MP.INVE/Pages/Starter.razor.cs new file mode 100644 index 00000000..1227da09 --- /dev/null +++ b/MP.INVE/Pages/Starter.razor.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; + +namespace MP.INVE.Pages +{ + public partial class Starter + { + [Inject] + private IConfiguration Configuration { get; set; } = null !; + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); + await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); + } + } + + protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrl"]}"; } + + protected string rawCode + { + get + { + string answ = ""; + answ = $"{BaseUrlTab}MatrOpr={101}&UserAuthKey={12345}"; + return answ; + } + } + } +} \ No newline at end of file From f7d40af040756e7db9d7e3b37917e9bda0d47b55 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 15 Nov 2022 17:42:48 +0100 Subject: [PATCH 3/7] fix condizione modifica nel readme --- MP.INVE/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MP.INVE/README.md b/MP.INVE/README.md index e670ce8c..9c897b55 100644 --- a/MP.INVE/README.md +++ b/MP.INVE/README.md @@ -106,7 +106,7 @@ Operativamente una volta letti questi codici dovrà svolgersi il seguente proces * richiesta all'operatore di verifica che si tratti di prima lettura (per evitare doppie letture l'operatore dovrebbe marcare/siglare ogni collo con un simbolo/data/etichetta comprovante l'effettuata lettura inventario') * presentazione all'operatore dei dati per conferma OBBLIGATORIA ad ogni lettura - * Salvataggio, in caso di modifica dei valori proposti la prima volta, della "Forzatura" + * Salvataggio, in caso di modifica dei valori proposti la prima volta, della "Forzatura", previo controllo della presenza del lotto all'interno delle anagrafiche Questo significa che è possibile avere in uscita liste di giacenza * con possibili "errori di doppia lettura" @@ -132,7 +132,7 @@ Operativamente una volta letti questi codici dovrà svolgersi il seguente proces * in alternativa proposta quantità/collo, articolo e lotto a partire dall'ultimo valore letto di tipo (C), salvataggio successivo in MAPO del codice + dati specifici * richiesta all'operatore di verifica che si tratti di prima lettura (per evitare doppie letture l'operatore dovrebbe marcare/siglare ogni collo con un simbolo/data/etichetta comprovante l'effettuata lettura inventario') * presentazione all'operatore dei dati per conferma OBBLIGATORIA ad ogni lettura - * Salvataggio, in caso di modifica dei valori proposti la prima volta, della "Forzatura" + * Salvataggio, in caso di modifica dei valori proposti la prima volta, della "Forzatura" previo controllo della presenza del lotto all'interno delle anagrafiche Questo significa che è possibile avere in uscita liste di giacenza * con possibili "errori di doppia lettura" @@ -189,3 +189,4 @@ Invio aggregato dei dati di |------------|----------------|:-------:|-----------------:| | 2022.11.10 | S.E. Locatelli | 0.1 | Initial draft | | 2022.11.10 | Gian / Zac | 0.2 | Second draft | +| 2022.11.15 | Zac | 0.3 | Aggiunta appunto su modifica post forzatura | From 5ced0fec533ec243f55a561800d56ef0ec416e31 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 15 Nov 2022 18:08:19 +0100 Subject: [PATCH 4/7] LAND: - fix warning compilazione - fix auth windows x login --- Egw.Core/SteamCrypto.cs | 16 +- Egw.Core/licenseManGLS.cs | 2 +- MP.Land/Components/CmpTop.razor | 4 +- MP.Land/Components/CmpTop.razor.cs | 25 +- MP.Land/Data/LicenseService.cs | 516 +++++++++++++------------ MP.Land/MP.Land.csproj | 3 +- MP.Land/Properties/launchSettings.json | 4 +- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- MP.Land/Startup.cs | 16 +- MP.Stats/MP.Stats.csproj | 2 +- MP.Stats/Resources/ChangeLog.html | 2 +- MP.Stats/Resources/VersNum.txt | 2 +- MP.Stats/Resources/manifest.xml | 2 +- 15 files changed, 312 insertions(+), 288 deletions(-) diff --git a/Egw.Core/SteamCrypto.cs b/Egw.Core/SteamCrypto.cs index 1f021d25..2373a2fc 100644 --- a/Egw.Core/SteamCrypto.cs +++ b/Egw.Core/SteamCrypto.cs @@ -23,18 +23,20 @@ namespace Egw.Core public static string DecryptString(string Message, string Passphrase) { string answ = Message; - byte[] Results = null; + byte[] Results = new byte[8]; UTF8Encoding UTF8 = new UTF8Encoding(); // Step 1. We hash the passphrase using MD5 // We use the MD5 hash generator as the result is a 128 bit byte array // which is a valid length for the TripleDES encoder we use below - MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider(); + var HashProvider = MD5.Create(); + //MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider(); byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(Passphrase)); // Step 2. Create a new TripleDESCryptoServiceProvider object - TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider(); + var TDESAlgorithm = TripleDES.Create(); + //TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider(); // Step 3. Setup the decoder TDESAlgorithm.Key = TDESKey; @@ -42,7 +44,7 @@ namespace Egw.Core TDESAlgorithm.Padding = PaddingMode.PKCS7; // Step 4. Convert the input string to a byte[] - byte[] DataToDecrypt = null; + byte[] DataToDecrypt = new byte[8]; try { DataToDecrypt = Convert.FromBase64String(Message); @@ -84,11 +86,13 @@ namespace Egw.Core // We use the MD5 hash generator as the result is a 128 bit byte array // which is a valid length for the TripleDES encoder we use below - MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider(); + var HashProvider = MD5.Create(); + //MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider(); byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(Passphrase)); // Step 2. Create a new TripleDESCryptoServiceProvider object - TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider(); + var TDESAlgorithm = TripleDES.Create(); + //TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider(); // Step 3. Setup the encoder TDESAlgorithm.Key = TDESKey; diff --git a/Egw.Core/licenseManGLS.cs b/Egw.Core/licenseManGLS.cs index fccea72c..c7108110 100644 --- a/Egw.Core/licenseManGLS.cs +++ b/Egw.Core/licenseManGLS.cs @@ -39,7 +39,7 @@ namespace Egw.Core } answ = Convert.ToDateTime(datePart); } - catch (Exception exc) + catch //(Exception exc) { //logger.lg.scriviLog(string.Format("Errore decodifica auth key:{0}AuthKey: {1}{0}cliente:{2}{0}applicativo:{3}{0}errore:{4}", Environment.NewLine, authKey, cliente, applicativo, exc), tipoLog.EXCEPTION); } diff --git a/MP.Land/Components/CmpTop.razor b/MP.Land/Components/CmpTop.razor index 534995a0..cb7100a0 100644 --- a/MP.Land/Components/CmpTop.razor +++ b/MP.Land/Components/CmpTop.razor @@ -4,12 +4,12 @@ @using MP.Land.Data @inject MessageService AppMessages -@*@inject AuthenticationStateProvider AuthenticationStateProvider*@ +@inject AuthenticationStateProvider AuthenticationStateProvider
    @**@ - @* @userName*@ + @userName
    @PageName diff --git a/MP.Land/Components/CmpTop.razor.cs b/MP.Land/Components/CmpTop.razor.cs index 1706938e..7b3b7d14 100644 --- a/MP.Land/Components/CmpTop.razor.cs +++ b/MP.Land/Components/CmpTop.razor.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Authorization; using System; using System.Threading.Tasks; @@ -62,20 +63,16 @@ namespace MP.Land.Components private async Task forceReload() { userName = "N.A."; - await Task.Delay(1); -#if false -var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); -var user = authState.User; - -if (user.Identity.IsAuthenticated) -{ -userName = $"{user.Identity.Name}"; -} -else -{ -userName = "N.A."; -} -#endif + await Task.Delay(1); var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); + var user = authState.User; + if (user.Identity != null && user.Identity.IsAuthenticated) + { + userName = $"{user.Identity.Name}"; + } + else + { + userName = "N.A."; + } } #endregion Private Methods diff --git a/MP.Land/Data/LicenseService.cs b/MP.Land/Data/LicenseService.cs index baeb055c..ede92400 100644 --- a/MP.Land/Data/LicenseService.cs +++ b/MP.Land/Data/LicenseService.cs @@ -12,6 +12,8 @@ using System.Text; using System.Threading.Tasks; using System.Web; +#nullable enable + namespace MP.Land.Data { /// @@ -19,56 +21,6 @@ namespace MP.Land.Data /// public class LicenseService { - #region Private Fields - - private static IConfiguration? _configuration; - private static ILogger? _logger; - - /// - /// URL dell'API x chiamate gestione licenze - /// - private static string apiUrl = "https://liman.egalware.com/ELM.API/"; - //private static string apiUrl = "https://localhost:44351/"; - - /// - /// Chiave redis x info della licenza - /// - private static string rkeyAppInfo = "LongCache:AppInfo"; - - private readonly IDistributedCache distributedCache; - - /// - /// Elenco obj in cache - /// - private List cachedDataList = new List(); - - /// - /// Fattorte conversione cache sliding --> 1 h - /// - private int cacheFact = 12; - - /// - /// Durata assoluta massima della cache IN SECONDI - /// - private int chAbsExp = 60 * 5; - - /// - /// Durata della cache IN SECONDI in modalità inattiva (non acceduta) prima di venire rimossa - /// NON estende oltre il tempo massimo di validità della cache (chAbsExp) - /// - private int chSliExp = 60 * 1; - - #endregion Private Fields - - #region Protected Fields - - /// - /// Chiave redis x attivazioni della licenza - /// - protected const string rKeyAttByLic = "LongCache:AttByLic"; - - #endregion Protected Fields - #region Public Constructors /// @@ -95,9 +47,7 @@ namespace MP.Land.Data #region Public Properties public List ActivList { get; set; } = new List(); - public List AKVList { get; set; } = new List(); - public string Applicazione { get; set; } = ""; public bool HasActivData @@ -158,74 +108,212 @@ namespace MP.Land.Data #endregion Public Properties - #region Private Methods + #region Public Methods - /// - /// Opzioni cache con moltiplicatore durata risp durata base (1/5 minuti) - /// - /// - /// - private DistributedCacheEntryOptions cacheOpt(int multFact) + public async Task> ActivListCache() { - var numSecAbsExp = chAbsExp * multFact; - var numSecSliExp = chSliExp * multFact; - return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp)); - } - - /// - /// Elenco attivazioni attuali - /// - private async Task?> OnlineActivationList() - { - List? answ = new List(); - // cerco online - RestClient client = new RestClient(apiUrl); - //client.Authenticator = new HttpBasicAuthenticator("username", "password"); - string MKeyEnc = HttpUtility.UrlEncode(MasterKey); - var request = new RestRequest($"api/attivazioni/?chiave={MKeyEnc}", Method.Get); - var response = await client.GetAsync(request); - // controllo risposta - if (response.StatusCode == System.Net.HttpStatusCode.OK) + List dbResult = new List(); + string cacheKey = $"{rKeyAttByLic}:{MasterKey}"; + trackCache(cacheKey); + string rawData = await getRSV(cacheKey); + if (!string.IsNullOrEmpty(rawData)) { - // salvo in redis contenuto serializzato - string rawData = $"{response.Content}"; - answ = JsonConvert.DeserializeObject?>(rawData); + var cacheRes = JsonConvert.DeserializeObject?>(rawData); + if (cacheRes != null) + { + dbResult = cacheRes; + } } - return await Task.FromResult(answ); + + return await Task.FromResult(dbResult); } /// - /// Recupera info licenza da remoto + /// Verifica attivazione licenza /// - private async Task> OnlineAppInfo() + /// + /// + public bool checkLicenseActive(string authKey) { - List answ = new List(); + bool answ = false; + //cerco anche nelle info AKV + if (AKVList != null) + { + var recLic = AKVList.Where(x => x.ValString == authKey).FirstOrDefault(); + int numLic = 0; + //cerco in record + if (recLic != null && recLic.ValInt != null) + { + numLic = (int)recLic.ValInt; + // verifico scadenza licenza! + DateTime scadenza = licenseManGLS.expiryDateByAuthKey(Installazione, recLic.NomeVar, numLic, authKey); + answ = scadenza > DateTime.Today; + } + else + { + _logger.LogInformation($"checkLicenseActive | Record non trovato per {authKey}"); + } + } + return answ; + } + + /// + /// Stato server gestione licenze + /// + public async Task checkLimanServer() + { + string answ = "ND"; // cerco online RestClient client = new RestClient(apiUrl); - string MKeyEnc = HttpUtility.UrlEncode(MasterKey); - //string mKey = System.Net.WebUtility.UrlEncode(MasterKey); - string reqUrl = $"api/licenza/{Installazione}?CodApp={Applicazione}&Chiave={MKeyEnc}"; - var request = new RestRequest(reqUrl, Method.Get); + var request = new RestRequest($"api/health", Method.Get); var response = await client.GetAsync(request); // controllo risposta if (response.StatusCode == System.Net.HttpStatusCode.OK) { // verifico risposta - string rawData = $"{response.Content}"; - answ = JsonConvert.DeserializeObject?>(rawData); + if (response.Content != null) + { + answ = response.Content.Replace("\"", ""); + } } return await Task.FromResult(answ); } - private void ReportUpdated() + /// + /// Verifica scadenza licenza + /// + /// + /// + public DateTime getLicenseExpiry(string authKey) { + DateTime answ = DateTime.Today.AddDays(-1); + //cerco anche nelle info AKV + if (AKVList != null) + { + var recLic = AKVList.Where(x => x.ValString == authKey).FirstOrDefault(); + int numLic = 0; + //cerco in record + if (recLic != null && recLic.ValInt != null) + { + numLic = (int)recLic.ValInt; + // verifico scadenza licenza! + DateTime scadenza = licenseManGLS.expiryDateByAuthKey(Installazione, recLic.NomeVar, numLic, authKey); + answ = scadenza; + } + else + { + _logger.LogInformation($"getLicenseExpiry | Record non trovato per {authKey}"); + } + } + return answ; + } + + /// + /// Init della classe con variabili di base da Redis/DB + /// + public bool InitAkv() + { + bool fatto = false; + Applicazione = "MAPO"; + Installazione = getAVKStr("Installazione"); + MasterKey = getAVKStr(Applicazione); + NumLicDb = getAVKInt(Applicazione); + fatto = !string.IsNullOrEmpty($"{Installazione}{MasterKey}"); + return fatto; + } + + public async Task> LicAppCache() + { + List dbResult = new List(); + string cacheKey = $"{rkeyAppInfo}:{MasterKey}"; + trackCache(cacheKey); + string rawData = await getRSV(cacheKey); + if (!string.IsNullOrEmpty(rawData)) + { + var cacheRes = JsonConvert.DeserializeObject?>(rawData); + if (cacheRes != null) + { + dbResult = cacheRes; + } + } + + return await Task.FromResult(dbResult); + } + + /// + /// Init della classe con variabili di base da Redis/DB + /// + public async Task RefreshLicense() + { + bool fatto = false; + // scadenza info a 15 gg... + int numDays = 15; + + // dati applicativo + var appData = await OnlineAppInfo(); + if (appData != null) + { + if (appData.Count > 0) + { + fatto = await setAppInfo(appData, numDays); + // salvo info licenza... + NumLicRemote = appData[0].NumLicenze; + } + } + + // dati attivazioni + var onlineAct = await OnlineActivationList(); + if (onlineAct != null) + { + if (onlineAct.Count > 0) + { + infoExpiry = DateTime.Now.AddDays(numDays); + ActivList = onlineAct; + fatto = await setActivList(onlineAct, numDays); + } + } + await Task.Delay(1); + return fatto; + } + + public async Task setActivList(List newActList, int numDays) + { + bool fatto = false; + string cacheKey = $"{rKeyAttByLic}:{MasterKey}"; + var rawData = JsonConvert.SerializeObject(newActList); + await setRSV(cacheKey, rawData, numDays * cacheFact * 24); + fatto = true; if (EA_InfoUpdated != null) { EA_InfoUpdated?.Invoke(); } + return fatto; } - #endregion Private Methods + public async Task setAppInfo(List newAppInfo, int numDays) + { + bool fatto = false; + string cacheKey = $"{rkeyAppInfo}:{MasterKey}"; + var rawData = JsonConvert.SerializeObject(newAppInfo); + await setRSV(cacheKey, rawData, numDays * cacheFact * 24); + fatto = true; + if (EA_InfoUpdated != null) + { + EA_InfoUpdated?.Invoke(); + } + return fatto; + } + + #endregion Public Methods + + #region Protected Fields + + /// + /// Chiave redis x attivazioni della licenza + /// + protected const string rKeyAttByLic = "LongCache:AttByLic"; + + #endregion Protected Fields #region Protected Methods @@ -329,198 +417,120 @@ namespace MP.Land.Data #endregion Protected Methods - #region Public Methods + #region Private Fields - public async Task> ActivListCache() - { - List dbResult = new List(); - string cacheKey = $"{rKeyAttByLic}:{MasterKey}"; - trackCache(cacheKey); - string rawData = await getRSV(cacheKey); - if (!string.IsNullOrEmpty(rawData)) - { - var cacheRes = JsonConvert.DeserializeObject?>(rawData); - if (cacheRes != null) - { - dbResult = cacheRes; - } - } - - return await Task.FromResult(dbResult); - } + private static IConfiguration? _configuration; /// - /// Verifica attivazione licenza + /// URL dell'API x chiamate gestione licenze /// - /// + private static string apiUrl = "https://liman.egalware.com/ELM.API/"; + + /// + /// Chiave redis x info della licenza + /// + private static string rkeyAppInfo = "LongCache:AppInfo"; + + //private static string apiUrl = "https://localhost:44351/"; + private readonly IDistributedCache distributedCache; + + /// + /// Elenco obj in cache + /// + private List cachedDataList = new List(); + + /// + /// Fattorte conversione cache sliding --> 1 h + /// + private int cacheFact = 12; + + /// + /// Durata assoluta massima della cache IN SECONDI + /// + private int chAbsExp = 60 * 5; + + /// + /// Durata della cache IN SECONDI in modalità inattiva (non acceduta) prima di venire + /// rimossa NON estende oltre il tempo massimo di validità della cache (chAbsExp) + /// + private int chSliExp = 60 * 1; + + #endregion Private Fields + + #region Private Properties + + private static ILogger _logger { get; set; } = null!; + + #endregion Private Properties + + #region Private Methods + + /// + /// Opzioni cache con moltiplicatore durata risp durata base (1/5 minuti) + /// + /// /// - public bool checkLicenseActive(string authKey) + private DistributedCacheEntryOptions cacheOpt(int multFact) { - bool answ = false; - //cerco anche nelle info AKV - if (AKVList != null) - { - var recLic = AKVList.Where(x => x.ValString == authKey).FirstOrDefault(); - int numLic = 0; - //cerco in record - if (recLic != null) - { - numLic = (int)recLic.ValInt; - // verifico scadenza licenza! - DateTime scadenza = licenseManGLS.expiryDateByAuthKey(Installazione, recLic.NomeVar, numLic, authKey); - answ = scadenza > DateTime.Today; - } - else - { - _logger.LogInformation($"checkLicenseActive | Record non trovato per {authKey}"); - } - } - return answ; - } - /// - /// Verifica scadenza licenza - /// - /// - /// - public DateTime getLicenseExpiry(string authKey) - { - DateTime answ = DateTime.Today.AddDays(-1); - //cerco anche nelle info AKV - if (AKVList != null) - { - var recLic = AKVList.Where(x => x.ValString == authKey).FirstOrDefault(); - int numLic = 0; - //cerco in record - if (recLic != null) - { - numLic = (int)recLic.ValInt; - // verifico scadenza licenza! - DateTime scadenza = licenseManGLS.expiryDateByAuthKey(Installazione, recLic.NomeVar, numLic, authKey); - answ = scadenza; - } - else - { - _logger.LogInformation($"getLicenseExpiry | Record non trovato per {authKey}"); - } - } - return answ; + var numSecAbsExp = chAbsExp * multFact; + var numSecSliExp = chSliExp * multFact; + return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp)); } /// - /// Stato server gestione licenze + /// Elenco attivazioni attuali /// - public async Task checkLimanServer() + private async Task?> OnlineActivationList() { - string answ = "ND"; + List? answ = new List(); // cerco online RestClient client = new RestClient(apiUrl); - var request = new RestRequest($"api/health", Method.Get); + //client.Authenticator = new HttpBasicAuthenticator("username", "password"); + string MKeyEnc = HttpUtility.UrlEncode(MasterKey); + var request = new RestRequest($"api/attivazioni/?chiave={MKeyEnc}", Method.Get); var response = await client.GetAsync(request); // controllo risposta if (response.StatusCode == System.Net.HttpStatusCode.OK) { - // verifico risposta - answ = response.Content.Replace("\"", ""); + // salvo in redis contenuto serializzato + string rawData = $"{response.Content}"; + answ = JsonConvert.DeserializeObject?>(rawData); } return await Task.FromResult(answ); } /// - /// Init della classe con variabili di base da Redis/DB + /// Recupera info licenza da remoto /// - public bool InitAkv() + private async Task> OnlineAppInfo() { - bool fatto = false; - Applicazione = "MAPO"; - Installazione = getAVKStr("Installazione"); - MasterKey = getAVKStr(Applicazione); - NumLicDb = getAVKInt(Applicazione); - fatto = !string.IsNullOrEmpty($"{Installazione}{MasterKey}"); - return fatto; + List? answ = new List(); + // cerco online + RestClient client = new RestClient(apiUrl); + string MKeyEnc = HttpUtility.UrlEncode(MasterKey); + //string mKey = System.Net.WebUtility.UrlEncode(MasterKey); + string reqUrl = $"api/licenza/{Installazione}?CodApp={Applicazione}&Chiave={MKeyEnc}"; + var request = new RestRequest(reqUrl, Method.Get); + var response = await client.GetAsync(request); + // controllo risposta + if (response.StatusCode == System.Net.HttpStatusCode.OK) + { + // verifico risposta + string rawData = $"{response.Content}"; + answ = JsonConvert.DeserializeObject?>(rawData); + } + // restituisce valori o insieme vuoto + return await Task.FromResult(answ ?? new List()); } - public async Task> LicAppCache() + private void ReportUpdated() { - List dbResult = new List(); - string cacheKey = $"{rkeyAppInfo}:{MasterKey}"; - trackCache(cacheKey); - string rawData = await getRSV(cacheKey); - if (!string.IsNullOrEmpty(rawData)) - { - var cacheRes = JsonConvert.DeserializeObject?>(rawData); - if (cacheRes != null) - { - dbResult = cacheRes; - } - } - - return await Task.FromResult(dbResult); - } - - /// - /// Init della classe con variabili di base da Redis/DB - /// - public async Task RefreshLicense() - { - bool fatto = false; - // scadenza info a 15 gg... - int numDays = 15; - - // dati applicativo - var appData = await OnlineAppInfo(); - if (appData != null) - { - if (appData.Count > 0) - { - fatto = await setAppInfo(appData, numDays); - // salvo info licenza... - NumLicRemote = appData[0].NumLicenze; - } - } - - // dati attivazioni - var onlineAct = await OnlineActivationList(); - if (onlineAct != null) - { - if (onlineAct.Count > 0) - { - infoExpiry = DateTime.Now.AddDays(numDays); - ActivList = onlineAct; - fatto = await setActivList(onlineAct, numDays); - } - } - await Task.Delay(1); - return fatto; - } - - public async Task setActivList(List newActList, int numDays) - { - bool fatto = false; - string cacheKey = $"{rKeyAttByLic}:{MasterKey}"; - var rawData = JsonConvert.SerializeObject(newActList); - await setRSV(cacheKey, rawData, numDays * cacheFact * 24); - fatto = true; if (EA_InfoUpdated != null) { EA_InfoUpdated?.Invoke(); } - return fatto; } - public async Task setAppInfo(List newAppInfo, int numDays) - { - bool fatto = false; - string cacheKey = $"{rkeyAppInfo}:{MasterKey}"; - var rawData = JsonConvert.SerializeObject(newAppInfo); - await setRSV(cacheKey, rawData, numDays * cacheFact * 24); - fatto = true; - if (EA_InfoUpdated != null) - { - EA_InfoUpdated?.Invoke(); - } - return fatto; - } - - #endregion Public Methods + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index e5d244a5..f9e55a89 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2211.0416 + 6.16.2211.1518 @@ -45,6 +45,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/MP.Land/Properties/launchSettings.json b/MP.Land/Properties/launchSettings.json index aeaf5b5b..7f84d546 100644 --- a/MP.Land/Properties/launchSettings.json +++ b/MP.Land/Properties/launchSettings.json @@ -1,7 +1,7 @@ { "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, + "windowsAuthentication": true, + "anonymousAuthentication": false, "iisExpress": { "applicationUrl": "http://localhost:7314", "sslPort": 44311 diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 9fbcacb8..d340f879 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

    Versione: 6.16.2211.0416

    +

    Versione: 6.16.2211.1518


    Note di rilascio:
      diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 3af0d134..b3babe51 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.0416 +6.16.2211.1518 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 2f81485a..3baa45d2 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.0416 + 6.16.2211.1518 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/Startup.cs b/MP.Land/Startup.cs index c599a8b6..e8f91d80 100644 --- a/MP.Land/Startup.cs +++ b/MP.Land/Startup.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Authentication.Negotiate; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Hosting; @@ -75,8 +76,8 @@ namespace MP.Land app.UseRouting(); - //app.UseAuthentication(); - //app.UseAuthorization(); + app.UseAuthentication(); + app.UseAuthorization(); app.UseEndpoints(endpoints => { @@ -103,6 +104,17 @@ namespace MP.Land o.SlidingExpiration = true; }); + + services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) + .AddNegotiate(); + + services.AddAuthorization(options => + { + // By default, all incoming requests will be authorized according to the default policy. + options.FallbackPolicy = options.DefaultPolicy; + }); + + services.AddStackExchangeRedisCache(options => { //options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions() { KeepAlive = 180, DefaultDatabase = 1, EndPoints = { { "localhost", 6379 } } }; diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 8683fb68..39ac2560 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,7 +4,7 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2210.2110 + 6.16.2211.1517 diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index c3a834ed..5e47116b 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

      Versione: 6.16.2210.2110

      +

      Versione: 6.16.2211.1517


      Note di rilascio:
        diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index 148d3a17..b5d4a429 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2210.2110 +6.16.2211.1517 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index b9e7e7bc..920440d2 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2210.2110 + 6.16.2211.1517 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false From 5a286e76ed6edfd556349ac537d340de1a19ad2f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 15 Nov 2022 18:09:55 +0100 Subject: [PATCH 5/7] Update vers script da eseguire --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28d7a489..cd12eb99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,6 +27,7 @@ variables: .fixVers: &fixVers - | $VersScript = $env:APP_NAME + "\bin\publish\post-build.ps1 -ProjectDir $CI_PROJECT_DIR\$env:APP_NAME -ProjectPath $CI_PROJECT_DIR\$env:APP_NAME\$env:APP_NAME.csproj" + $VersScript echo "Script called: $VersScript" # helper creazione hash files x IIS From 7ed80d83ec67fb93dffa1cebf76f091c34580393 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 15 Nov 2022 18:21:10 +0100 Subject: [PATCH 6/7] update verbosity x publish --- .gitlab-ci.yml | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cd12eb99..53292c31 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -266,7 +266,7 @@ LAND:IIS01:deploy: - develop needs: ["LAND:test"] script: - - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj PROG:IIS01:deploy: stage: deploy @@ -282,7 +282,7 @@ PROG:IIS01:deploy: - develop needs: ["PROG:test"] script: - - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj STAT:IIS01:deploy: stage: deploy @@ -298,7 +298,7 @@ STAT:IIS01:deploy: - develop needs: ["STAT:test"] script: - - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj MON:IIS01:deploy: stage: deploy @@ -314,7 +314,7 @@ MON:IIS01:deploy: - develop needs: ["MON:test"] script: - - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj # WAMON:IIS01:deploy: # stage: deploy @@ -347,7 +347,7 @@ SPEC:IIS01:deploy: - develop needs: ["SPEC:test"] script: - - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj LAND:IIS02:deploy: stage: deploy @@ -363,8 +363,8 @@ LAND:IIS02:deploy: - master needs: ["LAND:build"] script: - - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj PROG:IIS02:deploy: stage: deploy @@ -380,8 +380,8 @@ PROG:IIS02:deploy: - master needs: ["PROG:build"] script: - - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj STAT:IIS02:deploy: stage: deploy @@ -397,8 +397,8 @@ STAT:IIS02:deploy: - master needs: ["STAT:build"] script: - - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj MON:IIS02:deploy: stage: deploy @@ -414,8 +414,8 @@ MON:IIS02:deploy: - master needs: ["MON:build"] script: - - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj # WAMON:IIS02:deploy: # stage: deploy @@ -449,8 +449,8 @@ SPEC:IIS02:deploy: - master needs: ["SPEC:build"] script: - - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj LAND:installer: stage: installer @@ -468,7 +468,7 @@ LAND:installer: - master needs: ["LAND:build"] script: - - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish + - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - *fixVers - *hashBuild @@ -490,7 +490,7 @@ PROG:installer: - master needs: ["PROG:build"] script: - - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish + - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - *fixVers - *hashBuild @@ -512,7 +512,7 @@ STAT:installer: - master needs: ["STAT:build"] script: - - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish + - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - *fixVers - *hashBuild @@ -534,7 +534,7 @@ MON:installer: - master needs: ["MON:build"] script: - - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish + - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - *fixVers - *hashBuild @@ -578,7 +578,7 @@ SPEC:installer: - master needs: ["SPEC:build"] script: - - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish + - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - *fixVers - *hashBuild @@ -606,7 +606,7 @@ LAND:release: paths: - publish/ script: - - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet PROG:release: stage: release @@ -630,7 +630,7 @@ PROG:release: paths: - publish/ script: - - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet STAT:release: stage: release @@ -654,7 +654,7 @@ STAT:release: paths: - publish/ script: - - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet MON:release: stage: release @@ -676,7 +676,7 @@ MON:release: paths: - publish/ script: - - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet # WAMON:release: # stage: release @@ -721,5 +721,5 @@ SPEC:release: paths: - publish/ script: - - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj + - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet From 8376c2c407f3d675bda73c739a4138a9915c6bf7 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 15 Nov 2022 18:28:52 +0100 Subject: [PATCH 7/7] CI/CD: - aggiunta step build pre publish - pulizia progetto WAMON da CI/CD --- .gitlab-ci.yml | 111 +++++++++---------------------------------------- 1 file changed, 20 insertions(+), 91 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 53292c31..35dea986 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,12 +24,6 @@ variables: dotnet nuget add source https://nexus.steamware.net/repository/nuget-proxy-v3/index.json -n nexus-proxy-v3 -u nugetUser -p viaDante16 --store-password-in-clear-text echo "Has Source: $hasSource" -.fixVers: &fixVers - - | - $VersScript = $env:APP_NAME + "\bin\publish\post-build.ps1 -ProjectDir $CI_PROJECT_DIR\$env:APP_NAME -ProjectPath $CI_PROJECT_DIR\$env:APP_NAME\$env:APP_NAME.csproj" - $VersScript - echo "Script called: $VersScript" - # helper creazione hash files x IIS .hashBuild: &hashBuild - | @@ -266,6 +260,7 @@ LAND:IIS01:deploy: - develop needs: ["LAND:test"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj PROG:IIS01:deploy: @@ -282,6 +277,7 @@ PROG:IIS01:deploy: - develop needs: ["PROG:test"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj STAT:IIS01:deploy: @@ -298,6 +294,7 @@ STAT:IIS01:deploy: - develop needs: ["STAT:test"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj MON:IIS01:deploy: @@ -314,25 +311,9 @@ MON:IIS01:deploy: - develop needs: ["MON:test"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj -# WAMON:IIS01:deploy: -# stage: deploy -# tags: -# - win -# variables: -# PROJ_PATH: MP.WASM.Mon\Server -# APP_NAME: MP.WASM.Mon.Server -# SOL_NAME: MP-WAMON -# before_script: -# - *nuget-fix -# - dotnet restore "$env:SOL_NAME.sln" -# only: -# - develop -# needs: ["WAMON:test"] -# script: -# - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj - SPEC:IIS01:deploy: stage: deploy tags: @@ -347,6 +328,7 @@ SPEC:IIS01:deploy: - develop needs: ["SPEC:test"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj LAND:IIS02:deploy: @@ -363,6 +345,7 @@ LAND:IIS02:deploy: - master needs: ["LAND:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj @@ -380,6 +363,7 @@ PROG:IIS02:deploy: - master needs: ["PROG:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj @@ -397,6 +381,7 @@ STAT:IIS02:deploy: - master needs: ["STAT:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj @@ -414,27 +399,10 @@ MON:IIS02:deploy: - master needs: ["MON:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj -# WAMON:IIS02:deploy: -# stage: deploy -# tags: -# - win -# variables: -# PROJ_PATH: MP.WASM.Mon\Server -# APP_NAME: MP.WASM.Mon.Server -# SOL_NAME: MP-WAMON -# before_script: -# - *nuget-fix -# - dotnet restore "$env:SOL_NAME.sln" -# only: -# - master -# needs: ["WAMON:build"] -# script: -# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj -# - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj - SPEC:IIS02:deploy: stage: deploy tags: @@ -449,6 +417,7 @@ SPEC:IIS02:deploy: - master needs: ["SPEC:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj @@ -468,9 +437,9 @@ LAND:installer: - master needs: ["LAND:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - - *fixVers - *hashBuild - *nexusUpload @@ -490,9 +459,9 @@ PROG:installer: - master needs: ["PROG:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - - *fixVers - *hashBuild - *nexusUpload @@ -512,9 +481,9 @@ STAT:installer: - master needs: ["STAT:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - - *fixVers - *hashBuild - *nexusUpload @@ -534,34 +503,12 @@ MON:installer: - master needs: ["MON:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - - *fixVers - *hashBuild - *nexusUpload -# WAMON:installer: -# stage: installer -# tags: -# - win -# variables: -# PROJ_PATH: MP.WASM.Mon\Server -# APP_NAME: MP.WASM.Mon.Server -# SOL_NAME: MP-WAMON -# NEXUS_PATH: MP-WAMON -# before_script: -# - *nuget-fix -# - dotnet restore "$env:SOL_NAME.sln" -# only: -# - develop -# - master -# needs: ["WAMON:build"] -# script: -# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:PROJ_PATH/$env:APP_NAME.csproj -o:publish -# # qui il deploy su nexus... -# - *hashBuild -# - *nexusUpload - SPEC:installer: stage: installer tags: @@ -578,9 +525,9 @@ SPEC:installer: - master needs: ["SPEC:build"] script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet # qui il deploy su nexus... - - *fixVers - *hashBuild - *nexusUpload @@ -606,6 +553,7 @@ LAND:release: paths: - publish/ script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet PROG:release: @@ -630,6 +578,7 @@ PROG:release: paths: - publish/ script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet STAT:release: @@ -654,6 +603,7 @@ STAT:release: paths: - publish/ script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet MON:release: @@ -676,31 +626,9 @@ MON:release: paths: - publish/ script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet -# WAMON:release: -# stage: release -# tags: -# - win -# variables: -# PROJ_PATH: MP.WASM.Mon\Server -# APP_NAME: MP.WASM.Mon.Server -# SOL_NAME: MP-WAMON -# NEXUS_PATH: MP-WAMON -# before_script: -# - *nuget-fix -# - dotnet restore "$env:SOL_NAME.sln" -# only: -# - tags -# except: -# - branches -# needs: ["WAMON:build"] -# artifacts: -# paths: -# - publish/ -# script: -# - dotnet publish -c Release -o ./publish $env:PROJ_PATH/$env:APP_NAME.csproj - SPEC:release: stage: release tags: @@ -721,5 +649,6 @@ SPEC:release: paths: - publish/ script: + - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet