-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #577 from Inxton/551-auto-logo-off-does-not-start-…
…countdown-unless-authorized-context-is-activated 551 auto logo off does not start countdown unless authorized context is activated
- Loading branch information
Showing
21 changed files
with
631 additions
and
309 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
src/Security/src/AXOpen.Security.Blazor/Views/BaseSecurityView.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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
| ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.AspNetCore.Components.Authorization; | ||
using Microsoft.AspNetCore.Identity; | ||
using System.Security.Principal; | ||
using AxOpen.Security.Entities; | ||
using AxOpen.Security.Services; | ||
using AXOpen; | ||
using AXOpen.Base.Dialogs; | ||
using Microsoft.Extensions.Localization; | ||
|
||
namespace AxOpen.Security.Views | ||
{ | ||
public class BaseSecurityView : Microsoft.AspNetCore.Components.ComponentBase | ||
{ | ||
[Inject] | ||
protected UserManager<User> _userManager { get; set; } | ||
[Inject] | ||
protected SignInManager<User> _signInManager { get; set; } | ||
|
||
[Inject] | ||
protected NavigationManager _navigationManager { get; set; } | ||
|
||
[Inject] | ||
protected AuthenticationStateProvider _authenticationStateProvider { get; set; } | ||
|
||
[Inject] | ||
protected IRepositoryService _repositoryService { get; set; } | ||
|
||
[Inject] | ||
protected IAlertService? _alertDialogService { get; set; } | ||
|
||
protected async Task<IIdentity> GetCurrentIdentity() | ||
{ | ||
if (_authenticationStateProvider == null) | ||
{ | ||
return new GenericIdentity("Unknown"); | ||
} | ||
else | ||
{ | ||
var context = await _authenticationStateProvider.GetAuthenticationStateAsync(); | ||
|
||
if (context != null) | ||
{ | ||
return context.User.Identity; | ||
} | ||
else return new GenericIdentity("Unknown"); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.