小编par*_*ix2的帖子

SyntaxFactory 生成构造函数并调用基类构造函数

我编写了根据初始状态生成新类的代码。Roslyn 为其提供了类SyntaxFactory,但我不明白如何通过调用基类来生成构造函数,如下所示:

public TestClientApi(String entryPoint) : **base(entryPoint)**
{
    _entryPoint = entryPoint;
}
Run Code Online (Sandbox Code Playgroud)

https://github.com/ddydeveloper/Roslyn.ApiClient.Codegen

任何想法?

c# roslyn

6
推荐指数
1
解决办法
2219
查看次数

IdentityServer4分别对每个客户端进行身份验证

我使用两个不同的客户端。IdentityServer4提供API保护和登录表单。我可以配置客户端以避免单点登录吗?我的意思是,即使我登录了第一个客户端,我也需要登录第二个客户端。

我的ID4配置:

internal static IEnumerable<Client> GetClients(IEnumerable<RegisteredClient> clients)
{
    return clients.Select(x =>
    {
        var scopes = x.AllowedScopes.ToList();
        scopes.Add(IdentityServerConstants.StandardScopes.OpenId);
        scopes.Add(IdentityServerConstants.StandardScopes.Profile);
        scopes.Add(IdentityServerConstants.StandardScopes.OfflineAccess);

        var client = new Client
        {
            ClientId = x.Id,
            ClientName = x.Name,
            AllowedGrantTypes = GrantTypes.Hybrid,

            RequireConsent = false,

            RefreshTokenExpiration = TokenExpiration.Sliding,
            RefreshTokenUsage = TokenUsage.ReUse,

            ClientSecrets = {new Secret(x.Secret.Sha256())},
            RedirectUris = new[] {$"{x.Url}/signin-oidc"},
            PostLogoutRedirectUris = new[] {$"{x.Url}/signout-callback-oidc"},

            UpdateAccessTokenClaimsOnRefresh = true,

            AllowAccessTokensViaBrowser = true,
            AllowedScopes = scopes,
            AllowedCorsOrigins = {x.Url},
            AllowOfflineAccess = true
        };

        return client;
    });
}
Run Code Online (Sandbox Code Playgroud)

所有客户端都有相同的注册码(也许这是一个问题):

const string oidcScheme = …
Run Code Online (Sandbox Code Playgroud)

authentication single-sign-on identityserver4 asp-net-core-spa-services

4
推荐指数
1
解决办法
3391
查看次数