|
@@ -12,6 +12,8 @@ using XF.Domain.Exceptions;
|
|
|
using XF.Utility.AppIdentityModel;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.Users;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using XF.Domain.Options;
|
|
|
|
|
|
namespace Hotline.Api.Controllers;
|
|
|
|
|
@@ -29,6 +31,7 @@ public class UserController : BaseController
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly IAccountRepository _accountRepository;
|
|
|
private readonly IAccountDomainService _accountDomainService;
|
|
|
+ private readonly IOptions<IdentityConfiguration> _identityConfigurationAccessor;
|
|
|
|
|
|
public UserController(
|
|
|
ISessionContext sessionContext,
|
|
@@ -39,7 +42,8 @@ public class UserController : BaseController
|
|
|
IUserCacheManager userCacheManager,
|
|
|
IMapper mapper,
|
|
|
IAccountRepository accountRepository,
|
|
|
- IAccountDomainService accountDomainService)
|
|
|
+ IAccountDomainService accountDomainService,
|
|
|
+ IOptions<IdentityConfiguration> identityConfigurationAccessor)
|
|
|
{
|
|
|
_sessionContext = sessionContext;
|
|
|
_userDomainService = userDomainService;
|
|
@@ -50,6 +54,7 @@ public class UserController : BaseController
|
|
|
_mapper = mapper;
|
|
|
_accountRepository = accountRepository;
|
|
|
_accountDomainService = accountDomainService;
|
|
|
+ _identityConfigurationAccessor = identityConfigurationAccessor;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -142,6 +147,8 @@ public class UserController : BaseController
|
|
|
if (account is null)
|
|
|
{
|
|
|
account = _mapper.Map<Account>(dto);
|
|
|
+ var jwtOptions = _identityConfigurationAccessor.Value.Jwt;
|
|
|
+ account.ClientId = jwtOptions.Issuer;
|
|
|
await _accountRepository.AddAsync(account, HttpContext.RequestAborted);
|
|
|
var user = _mapper.Map<User>(dto);
|
|
|
user.Id = account.Id;
|