IdentityServer多IDP配置请求

时间:2016-06-21 03:27:45

标签: postman identityserver3 kentor-authservices

如何创建使用Saml或Google IDP进行授权的请求?我的理解是,如果我在请求中加入“acr_values = idp:Google”,那么请求将通过我的Google Idp路径进行路由。同样,如果我把“acr_values = idp:saml2p”,它应该通过我的Saml Idp。这是一条不同的道路吗?现在请求转到localhost:98575 / connect / token。

这是我目前的要求:

POST /connect/token HTTP/1.1
Host: localhost:98575
Authorization: Basic  SomethingEncrypted
Cache-Control: no-cache
Postman-Token: AGuid
Content-Type: application/x-www-form-urlencoded

grant_type=password&scope=customScope+openid+offline_access&username=actuallyfoobar@enterprisebeta.com&password=SomePassword&acr_values=idp:Google

以下是IdentityServer Starup.cs文件中的代码段:

public static void ConfigureIdentityProviders(IAppBuilder app, string signInAsType)

    {
        var authServicesOptions = new KentorAuthServicesAuthenticationOptions(false)
        {
            SPOptions = new SPOptions
            {
                EntityId = new EntityId("http://sp.example.com")
            },

            SignInAsAuthenticationType = signInAsType,
            AuthenticationType = "saml2p",
            Caption = "SAML2p",
        };

        authServicesOptions.IdentityProviders.Add(new IdentityProvider(
            new EntityId("http://stubidp.kentor.se/Metadata"),
            authServicesOptions.SPOptions)
        {
            LoadMetadata = true,
        });

        app.UseKentorAuthServicesAuthentication(authServicesOptions);

        var google = new GoogleOAuth2AuthenticationOptions
        {
            AuthenticationType = "Google",
            Caption = "Google",
            SignInAsAuthenticationType = signInAsType,

            ClientId = "767400843187-8boio83mb57ruogr9af9ut09fkg56b27.apps.googleusercontent.com",
            ClientSecret = "5fWcBT0udKY7_b6E3gEiJlze"
        };
        app.UseGoogleAuthentication(google); 

1 个答案:

答案 0 :(得分:0)

带有“idp:foo”的acr_values仅用于授权端点,而不是令牌端点。 IOW,它仅用于自动将浏览器中的用户重定向到指示的外部身份提供者。