代码之家  ›  专栏  ›  技术社区  ›  Steve McNiven-Scott

如何在SAML2元数据输出中显示md:NameIDFormat?

  •  0
  • Steve McNiven-Scott  · 技术社区  · 6 年前

    只是 用户电子邮件:)

    那些该死的人要我加上 到我的SAML2元数据。。。很明显不在那里。

    <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-
    format:emailAddress</md:NameIDFormat>
    

    我们正在使用来自 https://github.com/Sustainsys/Saml2/ 为了让这一切发挥作用,但它的股票配置相当不错?

            additionalProviders["saml2p"] =
                    (IAppBuilder app, string signInAsType, AuthenticationProviderElement config) =>
                    {
                        var opt = new Saml2AuthenticationOptions(false)
                        {
                            SPOptions = new SPOptions
                            {
                                EntityId = new EntityId("https://my.site.ca")
                            },
                            SignInAsAuthenticationType = signInAsType,
                            AuthenticationType = "saml2p",
                            Caption = "MySite",
                            Notifications = new Saml2Notifications()
                            {
                                AcsCommandResultCreated = (result, response) =>
                                {
                                    var claimsIdentity = result.Principal.Identity as ClaimsIdentity;
    
                                    //None of this exists in the result
                                    var userEmail = claimsIdentity.Claims.FirstOrDefault(x => x.Type == "User.email");
                                    var userFirstName = claimsIdentity.Claims.FirstOrDefault(x => x.Type == "User.FirstName");
                                    var userLastName = claimsIdentity.Claims.FirstOrDefault(x => x.Type == "User.LastName");
                                },
                                LogoutCommandResultCreated = commandResult =>
                                {
                                    // Post logout URL
                                    commandResult.Location = new Uri("/login", UriKind.Relative);
                                }
                            },
                        };
    
                        Sustainsys.Saml2.Configuration.Options.GlobalEnableSha256XmlSignatures();
    
                        opt.IdentityProviders.Add(new IdentityProvider(
                          new EntityId("https://their.site.ca/shibboleth-idp/shibboleth"),
                          opt.SPOptions)
                        {
                            LoadMetadata = true
                        });
    
                        app.UseSaml2Authentication(opt);
                    };
    
            return additionalProviders;
    

    TL;DR;md:NameIDFormat不在SustainSys SAML2元数据输出中

    1 回复  |  直到 6 年前
        1
  •  0
  •   Steve McNiven-Scott    6 年前

    我端的配置是正确的,问题是shibboleth中的配置没有发送 http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier 索赔。