Browse Source

upgrade abp npm package

3.0
cKey 5 years ago
parent
commit
000be3acf6
  1. 10
      aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/IdentityServer/WeChatValidator/WeChatTokenGrantValidator.cs
  2. 6
      aspnet-core/services/account/AuthServer.Host/AuthIdentityServerModule.cs
  3. 2
      aspnet-core/services/account/AuthServer.Host/package.json

10
aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN/Abp/IdentityServer/WeChatValidator/WeChatTokenGrantValidator.cs

@ -80,11 +80,11 @@ namespace LINGYUN.Abp.IdentityServer.WeChatValidator
Localizer["InvalidGrant:WeChatCodeNotFound"]); Localizer["InvalidGrant:WeChatCodeNotFound"]);
return; return;
} }
var whchatOpenId = await WeChatOpenIdFinder.FindAsync(wechatCode); var wechatOpenId = await WeChatOpenIdFinder.FindAsync(wechatCode);
var currentUser = await UserManager.FindByLoginAsync("WeChat", whchatOpenId.OpenId); var currentUser = await UserManager.FindByLoginAsync("WeChat", wechatOpenId.OpenId);
if(currentUser == null) if(currentUser == null)
{ {
Logger.LogWarning("Invalid grant type: wechat openid: {0} not register", whchatOpenId.OpenId); Logger.LogWarning("Invalid grant type: wechat openid: {0} not register", wechatOpenId.OpenId);
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant,
Localizer["InvalidGrant:WeChatNotRegister"]); Localizer["InvalidGrant:WeChatNotRegister"]);
return; return;
@ -96,9 +96,9 @@ namespace LINGYUN.Abp.IdentityServer.WeChatValidator
{ {
additionalClaims.Add(new Claim(AbpClaimTypes.TenantId, currentUser.TenantId?.ToString())); additionalClaims.Add(new Claim(AbpClaimTypes.TenantId, currentUser.TenantId?.ToString()));
} }
additionalClaims.Add(new Claim(WeChatValidatorConsts.ClaimTypes.OpenId, whchatOpenId.OpenId)); additionalClaims.Add(new Claim(WeChatValidatorConsts.ClaimTypes.OpenId, wechatOpenId.OpenId));
await EventService.RaiseAsync(new UserLoginSuccessEvent(currentUser.UserName, whchatOpenId.OpenId, null)); await EventService.RaiseAsync(new UserLoginSuccessEvent(currentUser.UserName, wechatOpenId.OpenId, null));
context.Result = new GrantValidationResult(sub, context.Result = new GrantValidationResult(sub,
WeChatValidatorConsts.AuthenticationMethods.BasedWeChatAuthentication, additionalClaims.ToArray()); WeChatValidatorConsts.AuthenticationMethods.BasedWeChatAuthentication, additionalClaims.ToArray());
} }

6
aspnet-core/services/account/AuthServer.Host/AuthIdentityServerModule.cs

@ -79,6 +79,10 @@ namespace AuthServer.Host
}) })
.UseDashboard(); .UseDashboard();
}); });
PreConfigure<IIdentityServerBuilder>(builder =>
{
});
} }
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
@ -185,8 +189,10 @@ namespace AuthServer.Host
app.UseAbpRequestLocalization(); app.UseAbpRequestLocalization();
app.UseRouting(); app.UseRouting();
app.UseCors(DefaultCorsPolicyName); app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication();
app.UseMultiTenancy(); app.UseMultiTenancy();
app.UseIdentityServer(); app.UseIdentityServer();
app.UseAuthorization();
app.UseAuditing(); app.UseAuditing();
app.UseConfiguredEndpoints(); app.UseConfiguredEndpoints();

2
aspnet-core/services/account/AuthServer.Host/package.json

@ -3,6 +3,6 @@
"name": "my-app-identityserver", "name": "my-app-identityserver",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@abp/aspnetcore.mvc.ui.theme.basic": "^2.6.2" "@abp/aspnetcore.mvc.ui.theme.basic": "3.0.0"
} }
} }

Loading…
Cancel
Save