Browse Source

Merge pull request #19479 from abpframework/IdentitySession

Add `WebAssemblyAuthenticationStateProvider`.
pull/19514/head
Gizem Mutu Kurt 3 years ago
committed by GitHub
parent
commit
d1a61e6274
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      Directory.Packages.props
  2. 21
      framework/src/Volo.Abp.AspNetCore.Components.Web/wwwroot/libs/abp/js/abp.js
  3. 3
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs
  4. 2
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj
  5. 20
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs
  6. 184
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyAuthenticationStateProvider.cs
  7. 6
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyAuthenticationStateProviderOptions.cs
  8. 12
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs
  9. 23
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentPrincipalAccessor.cs
  10. 12
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyRemoteCurrentPrincipalAccessor.cs
  11. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs
  12. 3
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
  13. 4
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentitySessionRepository.cs
  14. 10
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentitySessionRepository.cs
  15. 14
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySessionRepository.cs
  16. 2
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/global.js
  17. 24
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/global.js
  18. 24
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/global.js
  19. 24
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/global.js
  20. 2
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/wwwroot/global.js

1
Directory.Packages.props

@ -161,6 +161,7 @@
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.5.1" />
<PackageVersion Include="TimeZoneConverter" Version="6.1.0" />
<PackageVersion Include="Unidecode.NET" Version="2.1.0" />
<PackageVersion Include="xunit" Version="2.6.1" />

21
framework/src/Volo.Abp.AspNetCore.Components.Web/wwwroot/libs/abp/js/abp.js

@ -126,7 +126,7 @@ var abp = abp || {};
// FULL SCREEN /////////////////
abp.utils.toggleFullscreen = function() {
abp.utils.toggleFullscreen = function () {
var elem = document.documentElement;
if (!document.fullscreenElement && !document.mozFullScreenElement &&
!document.webkitFullscreenElement && !document.msFullscreenElement) {
@ -152,7 +152,7 @@ var abp = abp || {};
}
}
abp.utils.requestFullscreen = function() {
abp.utils.requestFullscreen = function () {
var elem = document.documentElement;
if (!document.fullscreenElement && !document.mozFullScreenElement &&
!document.webkitFullscreenElement && !document.msFullscreenElement) {
@ -168,7 +168,7 @@ var abp = abp || {};
}
}
abp.utils.exitFullscreen = function() {
abp.utils.exitFullscreen = function () {
if (!(!document.fullscreenElement && !document.mozFullScreenElement &&
!document.webkitFullscreenElement && !document.msFullscreenElement)) {
if (document.exitFullscreen) {
@ -230,4 +230,19 @@ var abp = abp || {};
}, 250);
}
};
abp.utils.removeOidcUser = function () {
for (var i = 0; i < sessionStorage.length; i++) {
var key = sessionStorage.key(i);
if (key.startsWith('oidc.user:')) {
sessionStorage.removeItem(key);
}
}
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
if (key.startsWith('oidc.user:')) {
localStorage.removeItem(key);
}
}
}
})();

3
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs

@ -4,7 +4,6 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp;
using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp;
using Volo.Abp.Http.Client.Authentication;
using Volo.Abp.Security.Claims;
namespace Microsoft.Extensions.DependencyInjection;
@ -16,7 +15,6 @@ public static class AbpBlazorWebAppServiceCollectionExtensions
services.AddSingleton<AuthenticationStateProvider, RemoteAuthenticationStateProvider>();
services.Replace(ServiceDescriptor.Transient<IAbpAccessTokenProvider, CookieBasedWebAssemblyAbpAccessTokenProvider>());
services.Replace(ServiceDescriptor.Transient<ICurrentPrincipalAccessor, RemoteCurrentPrincipalAccessor>());
return services;
}
@ -27,7 +25,6 @@ public static class AbpBlazorWebAppServiceCollectionExtensions
services.AddScoped<AuthenticationStateProvider, RemoteAuthenticationStateProvider>();
services.Replace(ServiceDescriptor.Singleton<IAbpAccessTokenProvider, PersistentComponentStateAbpAccessTokenProvider>());
services.Replace(ServiceDescriptor.Transient<ICurrentPrincipalAccessor, RemoteCurrentPrincipalAccessor>());
return services;
}

2
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj

@ -27,6 +27,8 @@
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
<PackageReference Include="IdentityModel" />
</ItemGroup>
</Project>

20
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs

@ -1,7 +1,11 @@
using System;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Web.ExceptionHandling;
@ -47,6 +51,22 @@ public class AbpAspNetCoreComponentsWebAssemblyModule : AbpModule
.AddProvider(new AbpExceptionHandlingLoggerProvider(context.Services));
}
public override void PostConfigureServices(ServiceConfigurationContext context)
{
var msAuthenticationStateProvider = context.Services.FirstOrDefault(x => x.ServiceType == typeof(AuthenticationStateProvider));
if (msAuthenticationStateProvider is {ImplementationType: not null} &&
msAuthenticationStateProvider.ImplementationType.IsGenericType &&
msAuthenticationStateProvider.ImplementationType.GetGenericTypeDefinition() == typeof(RemoteAuthenticationService<,,>))
{
var webAssemblyAuthenticationStateProviderType = typeof(WebAssemblyAuthenticationStateProvider<,,>).MakeGenericType(
msAuthenticationStateProvider.ImplementationType.GenericTypeArguments[0],
msAuthenticationStateProvider.ImplementationType.GenericTypeArguments[1],
msAuthenticationStateProvider.ImplementationType.GenericTypeArguments[2]);
context.Services.Replace(ServiceDescriptor.Scoped(typeof(AuthenticationStateProvider), webAssemblyAuthenticationStateProviderType));
}
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
AsyncHelper.RunSync(() => OnApplicationInitializationAsync(context));

184
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyAuthenticationStateProvider.cs

@ -0,0 +1,184 @@
using System;
using System.Collections.Concurrent;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Net.Http;
using System.Security.Claims;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using IdentityModel.Client;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Microsoft.JSInterop;
using Volo.Abp.Security.Claims;
namespace Volo.Abp.AspNetCore.Components.WebAssembly;
/// <summary>
/// Blazor requests a new token each time it is initialized/refreshed.
/// This class is used to revoke a token that is no longer in use.
/// </summary>
public class WebAssemblyAuthenticationStateProvider<TRemoteAuthenticationState, TAccount, TProviderOptions> : RemoteAuthenticationService<TRemoteAuthenticationState, TAccount, TProviderOptions>
where TRemoteAuthenticationState : RemoteAuthenticationState
where TProviderOptions : new()
where TAccount : RemoteUserAccount
{
protected ILogger<RemoteAuthenticationService<TRemoteAuthenticationState, TAccount, TProviderOptions>> Logger { get; }
protected WebAssemblyCachedApplicationConfigurationClient WebAssemblyCachedApplicationConfigurationClient { get; }
protected IOptions<WebAssemblyAuthenticationStateProviderOptions> WebAssemblyAuthenticationStateProviderOptions { get; }
protected IHttpClientFactory HttpClientFactory { get; }
protected readonly static ConcurrentDictionary<string, string> AccessTokens = new ConcurrentDictionary<string, string>();
public WebAssemblyAuthenticationStateProvider(
IJSRuntime jsRuntime,
IOptionsSnapshot<RemoteAuthenticationOptions<TProviderOptions>> options,
NavigationManager navigation,
AccountClaimsPrincipalFactory<TAccount> accountClaimsPrincipalFactory,
ILogger<RemoteAuthenticationService<TRemoteAuthenticationState, TAccount, TProviderOptions>>? logger,
WebAssemblyCachedApplicationConfigurationClient webAssemblyCachedApplicationConfigurationClient,
IOptions<WebAssemblyAuthenticationStateProviderOptions> webAssemblyAuthenticationStateProviderOptions,
IHttpClientFactory httpClientFactory)
: base(jsRuntime, options, navigation, accountClaimsPrincipalFactory, logger)
{
Logger = logger ?? NullLogger<RemoteAuthenticationService<TRemoteAuthenticationState, TAccount, TProviderOptions>>.Instance;
WebAssemblyCachedApplicationConfigurationClient = webAssemblyCachedApplicationConfigurationClient;
WebAssemblyAuthenticationStateProviderOptions = webAssemblyAuthenticationStateProviderOptions;
HttpClientFactory = httpClientFactory;
AuthenticationStateChanged += async state =>
{
var user = await state;
if (user.User.Identity == null || !user.User.Identity.IsAuthenticated)
{
return;
}
var accessToken = await FindAccessTokenAsync();
if (!accessToken.IsNullOrWhiteSpace())
{
AccessTokens.TryAdd(accessToken, accessToken);
}
await TryRevokeOldAccessTokensAsync();
};
}
protected async override ValueTask<ClaimsPrincipal> GetAuthenticatedUser()
{
var accessToken = await FindAccessTokenAsync();
if (!accessToken.IsNullOrWhiteSpace())
{
AccessTokens.TryAdd(accessToken, accessToken);
}
await TryRevokeOldAccessTokensAsync();
return await base.GetAuthenticatedUser();
}
public async override Task<AuthenticationState> GetAuthenticationStateAsync()
{
var accessToken = await FindAccessTokenAsync();
if (!accessToken.IsNullOrWhiteSpace())
{
AccessTokens.TryAdd(accessToken, accessToken);
}
await TryRevokeOldAccessTokensAsync();
var state = await base.GetAuthenticationStateAsync();
var applicationConfigurationDto = await WebAssemblyCachedApplicationConfigurationClient.GetAsync();
if (state.User.Identity != null && state.User.Identity.IsAuthenticated && !applicationConfigurationDto.CurrentUser.IsAuthenticated)
{
await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync();
}
return state;
}
protected virtual async Task<string?> FindAccessTokenAsync()
{
var result = await RequestAccessToken();
if (result.Status != AccessTokenResultStatus.Success)
{
return null;
}
result.TryGetToken(out var token);
return token?.Value;
}
protected virtual async Task TryRevokeOldAccessTokensAsync()
{
if (AccessTokens.Count <= 1)
{
return;
}
var oidcProviderOptions = Options.ProviderOptions?.As<OidcProviderOptions>();
var authority = oidcProviderOptions?.Authority;
var clientId = oidcProviderOptions?.ClientId;
if (authority.IsNullOrWhiteSpace() || clientId.IsNullOrWhiteSpace())
{
return;
}
var revoked = false;
var revokeAccessTokens = AccessTokens.Select(x => x.Value);
var currentAccessToken = await FindAccessTokenAsync();
foreach (var accessToken in revokeAccessTokens)
{
if (accessToken == currentAccessToken)
{
continue;
}
if (!accessToken.IsNullOrWhiteSpace() && !currentAccessToken.IsNullOrWhiteSpace())
{
var handler = new JwtSecurityTokenHandler();
var currentSessionId = handler.ReadJwtToken(currentAccessToken)?.Claims?.FirstOrDefault(x => x.Type == AbpClaimTypes.SessionId);
var sessionId = handler.ReadJwtToken(accessToken)?.Claims?.FirstOrDefault(x => x.Type == AbpClaimTypes.SessionId);
if (sessionId?.Value == currentSessionId?.Value)
{
continue;
}
}
var httpClient = HttpClientFactory.CreateClient(nameof(WebAssemblyAuthenticationStateProvider<TRemoteAuthenticationState, TAccount, TProviderOptions>));
var result = await httpClient.RevokeTokenAsync(new TokenRevocationRequest
{
Address = authority.EnsureEndsWith('/') + WebAssemblyAuthenticationStateProviderOptions.Value.TokenRevocationUrl,
ClientId = clientId,
Token = accessToken,
});
if (!result.IsError)
{
AccessTokens.TryRemove(accessToken, out _);
revoked = true;
}
else
{
Logger.LogError(result.Raw);
}
}
if (revoked)
{
await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync();
}
}
}
internal class OidcUser
{
[JsonPropertyName("access_token")]
public string? AccessToken { get; set; }
}

6
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyAuthenticationStateProviderOptions.cs

@ -0,0 +1,6 @@
namespace Volo.Abp.AspNetCore.Components.WebAssembly;
public class WebAssemblyAuthenticationStateProviderOptions
{
public string TokenRevocationUrl { get; set; } = "connect/revocat";
}

12
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using Microsoft.JSInterop;
using Volo.Abp.AspNetCore.Components.Web.Security;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies;
@ -20,18 +21,22 @@ public class WebAssemblyCachedApplicationConfigurationClient : ICachedApplicatio
protected ApplicationConfigurationChangedService ApplicationConfigurationChangedService { get; }
protected IJSRuntime JSRuntime { get; }
public WebAssemblyCachedApplicationConfigurationClient(
AbpApplicationConfigurationClientProxy applicationConfigurationClientProxy,
ApplicationConfigurationCache cache,
ICurrentTenantAccessor currentTenantAccessor,
AbpApplicationLocalizationClientProxy applicationLocalizationClientProxy,
ApplicationConfigurationChangedService applicationConfigurationChangedService)
ApplicationConfigurationChangedService applicationConfigurationChangedService,
IJSRuntime jsRuntime)
{
ApplicationConfigurationClientProxy = applicationConfigurationClientProxy;
Cache = cache;
CurrentTenantAccessor = currentTenantAccessor;
ApplicationLocalizationClientProxy = applicationLocalizationClientProxy;
ApplicationConfigurationChangedService = applicationConfigurationChangedService;
JSRuntime = jsRuntime;
}
public virtual async Task InitializeAsync()
@ -53,6 +58,11 @@ public class WebAssemblyCachedApplicationConfigurationClient : ICachedApplicatio
Cache.Set(configurationDto);
if (!configurationDto.CurrentUser.IsAuthenticated)
{
await JSRuntime.InvokeVoidAsync("abp.utils.removeOidcUser");
}
ApplicationConfigurationChangedService.NotifyChanged();
CurrentTenantAccessor.Current = new BasicTenantInfo(

23
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentPrincipalAccessor.cs

@ -1,23 +0,0 @@
using System.Security.Claims;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Components.Web.Security;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Security.Claims;
namespace Volo.Abp.AspNetCore.Components.WebAssembly;
public class WebAssemblyCurrentPrincipalAccessor : CurrentPrincipalAccessorBase, ITransientDependency
{
protected AbpComponentsClaimsCache ClaimsCache { get; }
public WebAssemblyCurrentPrincipalAccessor(
IClientScopeServiceProviderAccessor clientScopeServiceProviderAccessor)
{
ClaimsCache = clientScopeServiceProviderAccessor.ServiceProvider.GetRequiredService<AbpComponentsClaimsCache>();
}
protected override ClaimsPrincipal GetClaimsPrincipal()
{
return ClaimsCache.Principal;
}
}

12
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteCurrentPrincipalAccessor.cs → framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyRemoteCurrentPrincipalAccessor.cs

@ -3,13 +3,13 @@ using System.Security.Claims;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Security.Claims;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.WebApp;
namespace Volo.Abp.AspNetCore.Components.WebAssembly;
public class RemoteCurrentPrincipalAccessor : CurrentPrincipalAccessorBase, ITransientDependency
public class WebAssemblyRemoteCurrentPrincipalAccessor : CurrentPrincipalAccessorBase, ITransientDependency
{
protected ApplicationConfigurationCache ApplicationConfigurationCache { get; }
public RemoteCurrentPrincipalAccessor(ApplicationConfigurationCache applicationConfigurationCache)
public WebAssemblyRemoteCurrentPrincipalAccessor(ApplicationConfigurationCache applicationConfigurationCache)
{
ApplicationConfigurationCache = applicationConfigurationCache;
}
@ -75,6 +75,10 @@ public class RemoteCurrentPrincipalAccessor : CurrentPrincipalAccessorBase, ITra
{
claims.Add(new Claim(AbpClaimTypes.PhoneNumberVerified, applicationConfiguration.CurrentUser.PhoneNumberVerified.ToString()));
}
if (applicationConfiguration.CurrentUser.SessionId != null)
{
claims.Add(new Claim(AbpClaimTypes.SessionId, applicationConfiguration.CurrentUser.SessionId));
}
if (!applicationConfiguration.CurrentUser.Roles.IsNullOrEmpty())
{
@ -84,6 +88,6 @@ public class RemoteCurrentPrincipalAccessor : CurrentPrincipalAccessorBase, ITra
}
}
return new ClaimsPrincipal(new ClaimsIdentity(claims, authenticationType: nameof(RemoteCurrentPrincipalAccessor)));
return new ClaimsPrincipal(new ClaimsIdentity(claims, authenticationType: nameof(WebAssemblyRemoteCurrentPrincipalAccessor)));
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs

@ -34,4 +34,6 @@ public class CurrentUserDto
public bool PhoneNumberVerified { get; set; }
public string[] Roles { get; set; } = default!;
public string? SessionId { get; set; }
}

3
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs

@ -158,7 +158,8 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp
EmailVerified = _currentUser.EmailVerified,
PhoneNumber = _currentUser.PhoneNumber,
PhoneNumberVerified = _currentUser.PhoneNumberVerified,
Roles = _currentUser.Roles
Roles = _currentUser.Roles,
SessionId = _currentUser.FindSessionId()
};
}

4
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentitySessionRepository.cs

@ -12,6 +12,10 @@ public interface IIdentitySessionRepository : IBasicRepository<IdentitySession,
Task<IdentitySession> GetAsync(string sessionId, CancellationToken cancellationToken = default);
Task<bool> ExistAsync(Guid id, CancellationToken cancellationToken = default);
Task<bool> ExistAsync(string sessionId, CancellationToken cancellationToken = default);
Task<List<IdentitySession>> GetListAsync(
string sorting = null,
int maxResultCount = int.MaxValue,

10
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentitySessionRepository.cs

@ -36,6 +36,16 @@ public class EfCoreIdentitySessionRepository : EfCoreRepository<IIdentityDbConte
return session;
}
public virtual async Task<bool> ExistAsync(Guid id, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync()).AnyAsync(x => x.Id == id, GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> ExistAsync(string sessionId, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync()).AnyAsync(x => x.SessionId == sessionId, GetCancellationToken(cancellationToken));
}
public virtual async Task<List<IdentitySession>> GetListAsync(
string sorting = null,
int maxResultCount = int.MaxValue,

14
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySessionRepository.cs

@ -39,6 +39,20 @@ public class MongoIdentitySessionRepository : MongoDbRepository<IAbpIdentityMong
return session;
}
public virtual async Task<bool> ExistAsync(Guid id, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken)))
.As<IMongoQueryable<IdentitySession>>()
.AnyAsync(x => x.Id == id, GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> ExistAsync(string sessionId, CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken)))
.As<IMongoQueryable<IdentitySession>>()
.AnyAsync(x => x.SessionId == sessionId, GetCancellationToken(cancellationToken));
}
public virtual async Task<List<IdentitySession>> GetListAsync(
string sorting = null,
int maxResultCount = int.MaxValue,

2
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

24
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

24
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

24
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

2
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save