fix sicurezza
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2311.1410</Version>
|
||||
<Version>6.16.2311.1411</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
@page "/logout"
|
||||
|
||||
<h3>logout</h3>
|
||||
<LoadingData></LoadingData>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
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_TAB_SERV;
|
||||
using MP_TAB_SERV.Shared;
|
||||
using MP_TAB_SERV.Components;
|
||||
using MP.Data;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using MP.Data.Services;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using EgwCoreLib.Razor;
|
||||
using Blazored.LocalStorage;
|
||||
|
||||
namespace MP_TAB_SERV.Pages
|
||||
{
|
||||
public partial class Logout
|
||||
{
|
||||
[Inject]
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
[Inject]
|
||||
protected TabDataService TDService { get; set; } = null!;
|
||||
[Inject]
|
||||
protected MessageService MsgServ { get; set; } = null!;
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await localStorage.SetItemAsync("currTkn", "");
|
||||
await TDService.OperatoreDeleteRedis(MsgServ.MatrOpr);
|
||||
NavMan.NavigateTo("regnewdevice");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2311.1410</h4>
|
||||
<h4>Versione: 6.16.2311.1411</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2311.1410
|
||||
6.16.2311.1411
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2311.1410</version>
|
||||
<version>6.16.2311.1411</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -200,8 +200,8 @@ namespace MP.Data.Services
|
||||
{
|
||||
result = dbTabController.ElencoOperatori();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
//rawData = JsonConvert.SerializeObject(result);
|
||||
//await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -256,22 +256,22 @@ namespace MP.Data.Services
|
||||
sw.Start();
|
||||
AnagOperatoriModel answ = null;
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:CurrOpr:{matrOpr}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
//string currKey = $"{redisBaseKey}:CurrOpr:login:{matrOpr}";
|
||||
//RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (rawData.HasValue)
|
||||
//{
|
||||
//var encrData = SteamCrypto.DecryptString(rawData, passPhrase);
|
||||
answ = JsonConvert.DeserializeObject<AnagOperatoriModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = dbTabController.LoginOperatore(matrOpr, authKey);
|
||||
//answ = JsonConvert.DeserializeObject<AnagOperatoriModel>($"{rawData}");
|
||||
//source = "REDIS";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(answ);
|
||||
//rawData = JsonConvert.SerializeObject(answ);
|
||||
//var encrData = SteamCrypto.EncryptString(rawData, passPhrase);
|
||||
await redisDb.StringSetAsync(currKey, rawData, ConfigCache);
|
||||
}
|
||||
//await redisDb.StringSetAsync(currKey, rawData, ConfigCache);
|
||||
//}
|
||||
answ = dbTabController.LoginOperatore(matrOpr, authKey);
|
||||
if (answ == null)
|
||||
{
|
||||
answ = new AnagOperatoriModel();
|
||||
@@ -285,7 +285,7 @@ namespace MP.Data.Services
|
||||
/// <summary>
|
||||
/// Scrive l'hash dell'oggetto curr opr
|
||||
/// </summary>
|
||||
/// <param name="currOpr"></param>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> OperatoreGetRedis(int matrOpr)
|
||||
{
|
||||
@@ -311,6 +311,36 @@ namespace MP.Data.Services
|
||||
await Task.Delay(1);
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Delete dell'oggetto opr serializzato
|
||||
/// </summary>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> OperatoreDeleteRedis(int matrOpr)
|
||||
{
|
||||
string source = "REDIS";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
bool answ = false;
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:CurrOpr:{matrOpr}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
var done = await ExecFlushRedisPattern(currKey);
|
||||
if (done)
|
||||
{
|
||||
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OperatoreDeleteRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
await Task.Delay(1);
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// legge l'hash dell'oggetto curr opr
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user