|
|
@ -64,7 +64,7 @@ namespace Shentun.WebPeis.Controllers |
|
|
_personRepository = personRepository; |
|
|
_personRepository = personRepository; |
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
} |
|
|
} |
|
|
[UnitOfWork(IsDisabled = true)] |
|
|
|
|
|
|
|
|
//[UnitOfWork(IsDisabled = true)]
|
|
|
public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context) |
|
|
public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
@ -73,6 +73,10 @@ namespace Shentun.WebPeis.Controllers |
|
|
|
|
|
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
var principal = new ClaimsPrincipal(); |
|
|
|
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
//确保只有授权的应用程序才能够调用
|
|
|
//确保只有授权的应用程序才能够调用
|
|
|
var httpClient = new HttpClient(); |
|
|
var httpClient = new HttpClient(); |
|
|
var request = new ClientCredentialsTokenRequest |
|
|
var request = new ClientCredentialsTokenRequest |
|
|
@ -100,7 +104,7 @@ namespace Shentun.WebPeis.Controllers |
|
|
var person = (await _personRepository.GetQueryableAsync()).Where(o => o.WechatOpenId == wechatSession.OpenId).FirstOrDefault(); |
|
|
var person = (await _personRepository.GetQueryableAsync()).Where(o => o.WechatOpenId == wechatSession.OpenId).FirstOrDefault(); |
|
|
|
|
|
|
|
|
var wechatUser = new WechatUserDto(); |
|
|
var wechatUser = new WechatUserDto(); |
|
|
var principal = new ClaimsPrincipal(); |
|
|
|
|
|
|
|
|
|
|
|
var claimsIdentity = new ClaimsIdentity(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|
|
var claimsIdentity = new ClaimsIdentity(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|
|
var scopes = context.Request.GetScopes(); |
|
|
var scopes = context.Request.GetScopes(); |
|
|
|
|
|
|
|
|
@ -175,7 +179,13 @@ namespace Shentun.WebPeis.Controllers |
|
|
// Otherwise, add the claim to the access tokens only.
|
|
|
// Otherwise, add the claim to the access tokens only.
|
|
|
_ => [OpenIddictConstants.Destinations.AccessToken] |
|
|
_ => [OpenIddictConstants.Destinations.AccessToken] |
|
|
}); |
|
|
}); |
|
|
await _unitOfWorkManager.Current.CompleteAsync(); |
|
|
|
|
|
|
|
|
// await _unitOfWorkManager.Current.CompleteAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await unitOfWork.CompleteAsync(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var authenticationProperties = new AuthenticationProperties(); |
|
|
var authenticationProperties = new AuthenticationProperties(); |
|
|
|
|
|
|
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) |
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) |
|
|
|