@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Volo.Abp ;
using Volo.Abp ;
using Volo.Abp.Application.Dtos ;
using Volo.Abp.Application.Dtos ;
using Volo.Abp.Data ;
using Volo.Abp.Data ;
using Volo.Abp.OpenIddict ;
using Volo.Abp.OpenIddict.Applications ;
using Volo.Abp.OpenIddict.Applications ;
namespace LINGYUN.Abp.OpenIddict.Applications ;
namespace LINGYUN.Abp.OpenIddict.Applications ;
@ -14,17 +13,14 @@ namespace LINGYUN.Abp.OpenIddict.Applications;
[Authorize(AbpOpenIddictPermissions.Applications.Default)]
[Authorize(AbpOpenIddictPermissions.Applications.Default)]
public class OpenIddictApplicationAppService : OpenIddictApplicationServiceBase , IOpenIddictApplicationAppService
public class OpenIddictApplicationAppService : OpenIddictApplicationServiceBase , IOpenIddictApplicationAppService
{
{
private readonly IAbpApplicationManager _ applicationManager ;
private readonly AbpApplicationManager _ applicationManager ;
private readonly AbpOpenIddictIdentifierConverter _ identifierConverter ;
private readonly IOpenIddictApplicationRepository _ applicationRepository ;
private readonly IOpenIddictApplicationRepository _ applicationRepository ;
public OpenIddictApplicationAppService (
public OpenIddictApplicationAppService (
IAbpApplicationManager applicationManager ,
AbpApplicationManager applicationManager ,
AbpOpenIddictIdentifierConverter identifierConverter ,
IOpenIddictApplicationRepository applicationRepository )
IOpenIddictApplicationRepository applicationRepository )
{
{
_ applicationManager = applicationManager ;
_ applicationManager = applicationManager ;
_ identifierConverter = identifierConverter ;
_ applicationRepository = applicationRepository ;
_ applicationRepository = applicationRepository ;
}
}
@ -47,7 +43,7 @@ public class OpenIddictApplicationAppService : OpenIddictApplicationServiceBase,
[Authorize(AbpOpenIddictPermissions.Applications.Create)]
[Authorize(AbpOpenIddictPermissions.Applications.Create)]
public async virtual Task < OpenIddictApplicationDto > CreateAsync ( OpenIddictApplicationCreateDto input )
public async virtual Task < OpenIddictApplicationDto > CreateAsync ( OpenIddictApplicationCreateDto input )
{
{
if ( await _ applicationManager . FindByClientIdAsync ( input . ClientId ) ! = null )
if ( await _ applicationRepository . FindByClientIdAsync ( input . ClientId ) ! = null )
{
{
throw new BusinessException ( OpenIddictApplicationErrorCodes . Applications . ClientIdExisted )
throw new BusinessException ( OpenIddictApplicationErrorCodes . Applications . ClientIdExisted )
. WithData ( nameof ( OpenIddictApplication . ClientId ) , input . ClientId ) ;
. WithData ( nameof ( OpenIddictApplication . ClientId ) , input . ClientId ) ;
@ -100,7 +96,7 @@ public class OpenIddictApplicationAppService : OpenIddictApplicationServiceBase,
[Authorize(AbpOpenIddictPermissions.Applications.Delete)]
[Authorize(AbpOpenIddictPermissions.Applications.Delete)]
public async virtual Task DeleteAsync ( Guid id )
public async virtual Task DeleteAsync ( Guid id )
{
{
var application = await _ applicationManager . FindByIdAsync ( _ identifierConverter . ToString ( id ) ) ;
var application = await _ applicationRepository . GetAsync ( id ) ;
await _ applicationManager . DeleteAsync ( application ) ;
await _ applicationManager . DeleteAsync ( application . ToModel ( ) ) ;
}
}
}
}