gpt4 book ai didi

IdentityServer4 IsValidReturnUrl对于有效的URL返回false

转载 作者:行者123 更新时间:2023-12-04 07:15:51 25 4
gpt4 key购买 nike

我有一个使用此客户端配置的测试项目:

public class Clients : IClientStore
{
public Task<Client> FindClientByIdAsync(string clientId)
{
return Task.FromResult(new Client
{
ClientId = "client.webforms",
ClientName = "WebForms Client",
AllowedGrantTypes = GrantTypes.Hybrid,
AllowAccessTokensViaBrowser = false,

ClientSecrets =
{
new Secret("1234".Sha256())
},

RedirectUris = { "http://localhost:9869/signin-oidc" },
PostLogoutRedirectUris = { "http://localhost:9869/" },

AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
CstIdSrvScopeTypes.TestWebForms
},
AllowOfflineAccess = false,
RequireConsent = false,

AlwaysIncludeUserClaimsInIdToken = true
});
}
}

当我尝试在LoginController中验证它时,我得到 false结果(这是从“即时窗口”中得到的:
returnUrl
"http://localhost:9869/signin-oidc"
this.identityServer.IsValidReturnUrl(returnUrl)
false
this.identityServer.GetAuthorizationContextAsync(returnUrl)结果也是 null。难道我做错了什么?

最佳答案

是的-配置客户端时,您需要添加一个RedirectUri,该客户端是上面列表中的RedirectUris之一。
就像是

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
SignInAsAuthenticationType = Settings.AuthenticationType,
Authority = config.Authority,
RedirectUri = config.RedirectUri
}

关于IdentityServer4 IsValidReturnUrl对于有效的URL返回false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43367483/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com