【问题标题】:IdentityServer4 How does oidc know where to redirect to from configurationIdentityServer4 oidc 如何知道从配置重定向到哪里
【发布时间】:2017-08-07 03:18:11
【问题描述】:

我正在运行 IdentityServer4 的 Javascript 客户端示例,配置如下:

var config = {
    authority: "https://localhost:44350",
    client_id: "Js",
    redirect_uri: "http://localhost:5003/callback.html",
    response_type: "id_token token",
    scope:"openid profile Api1",
    post_logout_redirect_uri : "http://localhost:5003/index.html",
};

当我点击登录按钮时,授权指向我的 IdentityServer4 实例,我被重定向到项目中的 Account/Login 路由。

我正在寻找每一个地方,但我没有看到它知道在哪里或如何知道重定向到该路由,这个配置在哪里?

【问题讨论】:

    标签: javascript c# openid-connect identityserver4


    【解决方案1】:

    它知道是因为存在与interaction URLs 的映射,这些映射被指定为IdentityServer Options 的一部分。要配置这些 url 以匹配您的控制器,您可以在 ConfigureServices 中执行以下操作:

    services.AddIdentityServer(options =>
    {
        options.UserInteraction = new UserInteractionOptions
        {
            //ensure that the url strings have a leading slash
            LoginUrl = "/foo/bar",<-foo/bar maps to your controller in charge of route [foo/bar]
            LogoutUrl = "/baz"
        }
    }
    

    希望这会有所帮助。

    【讨论】:

    • 我的项目中没有引用它是否默认为“帐户/登录”路径
    • 链接似乎死了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-23
    • 2011-07-15
    • 2018-08-07
    • 1970-01-01
    • 2018-10-30
    • 2023-01-12
    相关资源
    最近更新 更多