【问题标题】:How to initiate SLO request using Sustainsys如何使用 Sustainsys 发起 SLO 请求
【发布时间】:2020-11-06 01:37:29
【问题描述】:

尝试使用 Okta 处理 Single Log out 请求

我尝试在 Sustainsys 上使用示例代码,如下所示:

public async Task<IActionResult> Logout()
{
    await _signInManager.SignOutAsync();

    _logger.LogInformation("User logged out.");

    return SignOut(new AuthenticationProperties()
    {
        RedirectUri = "/Index"
    },
    Saml2Defaults.Scheme);
}

但这似乎并没有调用 Single Log Out。我只是被重定向到我的注销页面。从我读过的内容来看,它是受支持的,所以不确定我应该调用什么。在启动时,我加载了其中包含 SLO url 的元数据,因此它应该知道指向哪里。

Okta 需要证书,所以我在启动时添加了相关的 pfx 文件,如下所示:

        // Add Saml Athentication
        var authBuilder = services.AddAuthentication();
        authBuilder.AddSaml2(options =>
        {
            // SAML Okta options
            options.SPOptions.EntityId = new EntityId(Configuration["SAML:AudienceURI"]);

            // Set up redirect to SAML controller callback to handle log in after SAML Authentication (For Okta/IDP initiated log in)
            options.SPOptions.ReturnUrl = new Uri(Configuration["SAML:ReturnURL"]);

            // Scheme to handle the authentication
            options.SignInScheme = IdentityConstants.ExternalScheme;
            options.SignOutScheme = IdentityConstants.ApplicationScheme;

            // Set up Identity Provider
            var identityProvider = new IdentityProvider(
                new EntityId(Configuration["SAML:EntityID"]),
                options.SPOptions)
            {
                Binding = Saml2BindingType.HttpRedirect,
                LoadMetadata = true,
                MetadataLocation = Configuration["SAML:MetadataURL"],
                AllowUnsolicitedAuthnResponse = true
            };

            options.SPOptions.ServiceCertificates.Add(new X509Certificate2("Okta.pfx", ""));
            options.IdentityProviders.Add(identityProvider);
        });

有什么想法吗?我必须手动完成吗?如果是这样,任何指针都会很棒。

【问题讨论】:

    标签: asp.net-core saml saml-2.0 sustainsys-saml2


    【解决方案1】:

    好吧一定错过了,但答案是重定向到 /Saml2/Logout

    这仍然不起作用,因为不存在注销所需的声明,但此步骤可能对某人有所帮助。

    【讨论】:

    • 您可以重定向到 /Saml/Logout 或使用 SignOut。但是,如果没有必要的要求,那么任何一个都不会起作用。
    【解决方案2】:

    要使单一注销工作,需要满足许多要求。

    https://github.com/Sustainsys/Saml2/blob/74045327e15812c60610746bd0632f1f9236b5bd/Sustainsys.Saml2/WebSSO/LogOutCommand.cs#L175 处写有一条日志消息,在决定是否进行联合单一注销之前,将指示需求的状态。

    options.SPOptions.Logger.WriteVerbose("Initiating logout, checking requirements for federated logout"
    + "\n  Issuer of LogoutNameIdentifier claim (should be Idp entity id): " + idpEntityId
    + "\n  Issuer is a known Idp: " + knownIdp
    + "\n  Session index claim (should have a value): " + sessionIndexClaim
    + "\n  Idp has SingleLogoutServiceUrl: " + idp?.SingleLogoutServiceUrl?.OriginalString
    + "\n  There is a signingCertificate in SPOptions: " + (options.SPOptions.SigningServiceCertificate != null)
    + "\n  Idp configured to DisableOutboundLogoutRequests (should be false): " + idp?.DisableOutboundLogoutRequests);
    

    在 Asp.Net Core 中,非联合注销是无操作的 - Asp.Net 核心模型是应用程序需要同时注销联合方案和会话身份验证方案。

    【讨论】:

    • 你好@Anders,如何在External Provider注销之前注入这些数据,因为用户想回滚注册,所有数据都是空============ ================ 启动注销,检查联合注销的要求 LogoutNameIdentifier 声明的颁发者(应该是 Idp 实体 ID):颁发者是已知的 Idp:False 会话索引声明(应该有一个值):Idp 有 SingleLogoutServiceUrl:SPOptions 中有一个 signingCertificate:True Idp 配置为 DisableOutboundLogoutRequests(应该为 false):========================
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-08-19
    • 1970-01-01
    • 2017-01-17
    • 2021-02-17
    • 1970-01-01
    • 2020-08-21
    • 1970-01-01
    相关资源
    最近更新 更多