1

在 IdentityServer3 中,我根据文档使用SustainSys库配置了多个基于 SAML2 的外部提供程序实例。 我让它工作了,但我对aka有疑问。(这不是外部提供商给我们的 EntityID,而是我需要提供给外部提供商的 EntityID)
SPOptions.EntityIDAudience Uri

Audience Uri这对于每个实例应该是唯一的吗?

可以说,我在生产中配置了 2 个 SAML2 提供程序实例(Okta 和 Azure AD),然后根据提供的示例代码,对于特定环境,这Audience Uri将不是唯一的。

下面是我基于示例代码的代码。(为简洁起见,我删除了几行)

public class Startup
{        
    public void Configuration(IAppBuilder app)
    {
        app.Map("/identity", idsrvApp =>
        {
            var identityServerOptions = new IdentityServerOptions
            {                    
                AuthenticationOptions = new AuthenticationOptions()
                {         
                    EnableAutoCallbackForFederatedSignout = true,
                    EnableSignOutPrompt = false
                }
                .Configure(ConfigureExternalIdentityProviders)                    
            };
            idsrvApp.UseIdentityServer(identityServerOptions);
        });            
    }

    private void ConfigureExternalIdentityProviders(IAppBuilder app, string signInAsType)
    {           
        // Add okta
        AddSAML2Idp(
            app,                
            signInAsType,
            "https://id.mydomain.com/identity/Saml2", //audienceURI
            "okta", //idpname
            "okta", //caption
            "https://www.okta.com/exk4yxtgy7ZzSDp8e0h7", // externalEntityID
            "https://dev-490944.oktapreview.com/app/exk4yxtgy7ZzSDp8e0h7/sso/saml/metadata"); // metadataLocation

        // Add Azure AD
        AddSAML2Idp(app,                
            signInAsType,
            "https://id.mydomain.com/identity/Saml2", //audienceURI
            "azuread", //idpname
            "Azure ad", //caption
            "https://sts.windows.net/xxxxx-fb1d-40c4-xxxxx-xxxxxxxx/", //externalEntityID
            "https://login.microsoftonline.com/xxxx-fb1d-40c4-40c4-xxxxxxx/federationmetadata/2007-06/federationmetadata.xml?appid=xxxx-xxxx-xxxx-xxxx-xxxxxx"); //metadataLocation
    }      

    private void AddSAML2Idp(IAppBuilder app, string signInAsType,string audienceURI, string idpname, string caption, string externalEntityID, string metadataLocation)
    {
        var authenticationOptions = new Saml2AuthenticationOptions(false)
        {
            SPOptions = new SPOptions
            {
                EntityId = new EntityId(audienceURI),                     
                ModulePath = string.Format("/{0}", idpname)
            },
            SignInAsAuthenticationType = signInAsType,
            AuthenticationType = idpname,
            Caption = caption
        };

        UseIdSrv3LogoutOnFederatedLogout(app, authenticationOptions);

        authenticationOptions.SPOptions.ServiceCertificates.Add(LoadCertificateFromWindwosStore());

        var identityProvider = new IdentityProvider(new EntityId(externalEntityID), authenticationOptions.SPOptions)
        {                
            MetadataLocation = metadataLocation,
            LoadMetadata = true 
        };

        authenticationOptions.IdentityProviders.Add(identityProvider);

        app.UseSaml2Authentication(authenticationOptions);
    }

因此对于okata

Audience Uri: https://id.mydomain.com/identity/Saml2
ACS Uri: https://id.mydomain.com/identity/okta/acs

并且对于Azure AD

Audience Uri: https://id.mydomain.com/identity/Saml2
ACS Uri: https://id.mydomain.com/identity/azuread/acs

请注意,这两个实例的受众 uri 是相同的。

对于每个实例,它是否应该是唯一的,例如:

https://id.mydomain.com/identity/okta   
https://id.mydomain.com/identity/azuread   
4

1 回答 1

0

从逻辑上讲,这两个实例是两个不同的 SAML2 服务提供者,应该有不同的实体 ID。但是,由于您没有将它们都暴露给同一个上游 Idp,所以没关系。

于 2018-10-19T19:24:42.687 回答