Skip to content

1.4.0

Compare
Choose a tag to compare
@gdlcf88 gdlcf88 released this 15 Nov 17:13
· 117 commits to master since this release

Breaking Changes

由于 ABP 6.0 引入了新的 OpenIddict 授权模块,我们对 OpenIddict 和 IDS4 两个模块做了并存兼容。你需要按照以下步骤从旧版模块中升级。

  1. 安装新的 EasyAbp.WeChatManagement.MiniPrograms.Domain.OpenIddict 模块或 EasyAbp.WeChatManagement.MiniPrograms.Domain.Ids4 模块,代替原 EasyAbp.WeChatManagement.MiniPrograms.Domain 模块。

  2. 在 Web/Host 项目的 appsettings.json 中增加微信登录授权服务器配置:

    {
      "WeChatManagement": {
        "MiniPrograms": {
          "AuthServer": {
            "Authority": "https://localhost:44380",
            "ClientId": "MyProjectName_WeChatMiniProgram",
            "ClientSecret": "1q2w3e*"
          }
        }
      }
    }
  3. 在 OpenIddictDataSeedContributor 中增加新的客户端 Data Seed (你也可以使用 IDS4):

    // WeChat MiniProgram
    var weChatMiniProgramClientId =
        configurationSection["MyProjectName_WeChatMiniProgram:ClientId"];
    
    if (!weChatMiniProgramClientId.IsNullOrWhiteSpace())
    {
        await CreateApplicationAsync(
            name: weChatMiniProgramClientId,
            type: OpenIddictConstants.ClientTypes.Confidential,
            consentType: OpenIddictConstants.ConsentTypes.Implicit,
            displayName: "WeChat Mini-program",
            secret: configurationSection["MyProjectName_WeChatMiniProgram:ClientSecret"] ?? "1q2w3e*",
            grantTypes: new List<string>
            {
                WeChatMiniProgramConsts.GrantType,
                OpenIddictConstants.GrantTypes.RefreshToken
            },
            scopes: commonScopes
        );
    }
  4. 在 OpenIddictDataSeedContributor 中找到

    if (grantType == OpenIddictConstants.GrantTypes.ClientCredentials)
    {
        application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.ClientCredentials);
    }

    在下面增加

    if (grantType == WeChatMiniProgramConsts.GrantType)
    {
        application.Permissions.Add($"gt:{WeChatMiniProgramConsts.GrantType}");
    }
  5. 在 DbMigrator 项目的 appsettings.json 中增加:

    {
      "IdentityServer": {
        "Clients": {
          "MyProjectName_WeChatMiniProgram": {
            "ClientId": "MyProjectName_WeChatMiniProgram",
            "ClientSecret": "1q2w3e*"
          }
        }
      }
    }
  6. 运行 DbMigrator 项目,以创建新的授权客户端。

What's Changed

  • 升级到 ABP 6.0.1 并支持 OpenIddict 实现 by @gdlcf88 in #54

Full Changelog: 1.3.5...1.4.0