-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f837e35
commit 5af21ee
Showing
28 changed files
with
690 additions
and
787 deletions.
There are no files selected for viewing
38 changes: 17 additions & 21 deletions
38
src/template/src/Client.Infrastructure/Authentication/AuthenticationHeaderHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
using Blazored.LocalStorage; | ||
using GenocsBlazor.Shared.Constants.Storage; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace GenocsBlazor.Client.Infrastructure.Authentication | ||
namespace GenocsBlazor.Client.Infrastructure.Authentication; | ||
|
||
public class AuthenticationHeaderHandler : DelegatingHandler | ||
{ | ||
public class AuthenticationHeaderHandler : DelegatingHandler | ||
{ | ||
private readonly ILocalStorageService localStorage; | ||
private readonly ILocalStorageService _localStorage; | ||
|
||
public AuthenticationHeaderHandler(ILocalStorageService localStorage) | ||
=> this.localStorage = localStorage; | ||
public AuthenticationHeaderHandler(ILocalStorageService localStorage) | ||
=> _localStorage = localStorage; | ||
|
||
protected override async Task<HttpResponseMessage> SendAsync( | ||
HttpRequestMessage request, | ||
CancellationToken cancellationToken) | ||
protected override async Task<HttpResponseMessage> SendAsync( | ||
HttpRequestMessage request, | ||
CancellationToken cancellationToken) | ||
{ | ||
if (request.Headers.Authorization?.Scheme != "Bearer") | ||
{ | ||
if (request.Headers.Authorization?.Scheme != "Bearer") | ||
{ | ||
var savedToken = await this.localStorage.GetItemAsync<string>(StorageConstants.Local.AuthToken); | ||
string savedToken = await _localStorage.GetItemAsync<string>(StorageConstants.Local.AuthToken); | ||
|
||
if (!string.IsNullOrWhiteSpace(savedToken)) | ||
{ | ||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", savedToken); | ||
} | ||
if (!string.IsNullOrWhiteSpace(savedToken)) | ||
{ | ||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", savedToken); | ||
} | ||
|
||
return await base.SendAsync(request, cancellationToken); | ||
} | ||
|
||
return await base.SendAsync(request, cancellationToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 5 additions & 8 deletions
13
src/template/src/Client.Infrastructure/Managers/Audit/IAuditManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
using GenocsBlazor.Application.Responses.Audit; | ||
using GenocsBlazor.Shared.Wrapper; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace GenocsBlazor.Client.Infrastructure.Managers.Audit | ||
namespace GenocsBlazor.Client.Infrastructure.Managers.Audit; | ||
|
||
public interface IAuditManager : IManager | ||
{ | ||
public interface IAuditManager : IManager | ||
{ | ||
Task<IResult<IEnumerable<AuditResponse>>> GetCurrentUserTrailsAsync(); | ||
Task<IResult<IEnumerable<AuditResponse>>> GetCurrentUserTrailsAsync(); | ||
|
||
Task<IResult<string>> DownloadFileAsync(string searchString = "", bool searchInOldValues = false, bool searchInNewValues = false); | ||
} | ||
Task<IResult<string>> DownloadFileAsync(string searchString = "", bool searchInOldValues = false, bool searchInNewValues = false); | ||
} |
Oops, something went wrong.