Browse Source

added CheckClientIdExistAsync to IClientRepository

pull/1767/head
Yunus Emre Kalkan 7 years ago
parent
commit
00b0aa6b36
  1. 6
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs
  2. 5
      modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs
  3. 5
      modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs

6
modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs

@ -24,5 +24,11 @@ namespace Volo.Abp.IdentityServer.Clients
);
Task<List<string>> GetAllDistinctAllowedCorsOriginsAsync(CancellationToken cancellationToken = default);
Task<bool> CheckClientIdExistAsync(
string clientId,
Guid? expectedId = null,
CancellationToken cancellationToken = default
);
}
}

5
modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs

@ -46,6 +46,11 @@ namespace Volo.Abp.IdentityServer.Clients
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async Task<bool> CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default)
{
return await DbSet.AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken);
}
public override IQueryable<Client> WithDetails()
{
return GetQueryable().IncludeDetails();

5
modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs

@ -53,6 +53,11 @@ namespace Volo.Abp.IdentityServer.MongoDB
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async Task<bool> CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken);
}
public virtual async Task<long> GetTotalCount()
{
return await GetCountAsync();

Loading…
Cancel
Save