|
|
@ -41,7 +41,7 @@ namespace Shentun.WebPeis.Controllers |
|
|
} |
|
|
} |
|
|
[IgnoreAntiforgeryToken] |
|
|
[IgnoreAntiforgeryToken] |
|
|
[ApiExplorerSettings(IgnoreApi = true)] |
|
|
[ApiExplorerSettings(IgnoreApi = true)] |
|
|
public class WeChatController : AbpOpenIdDictControllerBase, ITokenExtensionGrant, IWeChatController,ITransientDependency |
|
|
|
|
|
|
|
|
public class WeChatController : AbpOpenIdDictControllerBase, ITokenExtensionGrant, IWeChatController, ITransientDependency |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
private readonly IConfiguration _configuration; |
|
|
private readonly IConfiguration _configuration; |
|
|
@ -83,7 +83,7 @@ namespace Shentun.WebPeis.Controllers |
|
|
ClientSecret = context.Request.GetParameter("client_secret").ToString(), |
|
|
ClientSecret = context.Request.GetParameter("client_secret").ToString(), |
|
|
}; |
|
|
}; |
|
|
var clientCredentialsResult = await httpClient.RequestClientCredentialsTokenAsync(request); |
|
|
var clientCredentialsResult = await httpClient.RequestClientCredentialsTokenAsync(request); |
|
|
if(clientCredentialsResult.IsError) |
|
|
|
|
|
|
|
|
if (clientCredentialsResult.IsError) |
|
|
{ |
|
|
{ |
|
|
throw new Exception("应用程序没有权限" + clientCredentialsResult.ErrorDescription); |
|
|
throw new Exception("应用程序没有权限" + clientCredentialsResult.ErrorDescription); |
|
|
} |
|
|
} |
|
|
@ -121,7 +121,7 @@ namespace Shentun.WebPeis.Controllers |
|
|
{ |
|
|
{ |
|
|
throw new Exception("用户不存在"); |
|
|
throw new Exception("用户不存在"); |
|
|
} |
|
|
} |
|
|
if(!user.IsActive) |
|
|
|
|
|
|
|
|
if (!user.IsActive) |
|
|
{ |
|
|
{ |
|
|
throw new Exception("用户已被禁用"); |
|
|
throw new Exception("用户已被禁用"); |
|
|
} |
|
|
} |
|
|
@ -181,7 +181,9 @@ namespace Shentun.WebPeis.Controllers |
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) |
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) |
|
|
{ |
|
|
{ |
|
|
//return SignIn(principal, authenticationProperties, wechatSession.OpenId);
|
|
|
//return SignIn(principal, authenticationProperties, wechatSession.OpenId);
|
|
|
return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|
|
|
|
|
|
|
|
var result = SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|
|
|
|
|
await unitOfWork.CompleteAsync(); |
|
|
|
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|