身份提供商发现和身份验证 - SAML 是正确的解决方案吗
Identity provider discovery and authentication - is SAML the right solution
我已经完成了一些 OpenID 集成,所以我知道我将要描述的问题是 OpenID 和 OAuth 可以解决的问题,但我是 SAML 的新手,并且试图将我的头脑集中在一个特定的用途上案例:
因此,假设用户访问 Site1,它要求用户确认他或她属于其他网站中的哪一个(Site2、Site3 等)
站点 1 无法对用户进行身份验证并依赖站点 2 或站点 3 进行身份验证,因此它会向用户提供一个站点列表以进行身份验证。
用户选择 Site2 或 Site3,在那里执行身份验证并重定向回 Site1。站点 1 确认用户并且它现在知道用户来自哪里。
问题:这是 SAML 要解决的有效问题吗?
IDP 通过 Home Realm Discovery 处理此问题。
如果 IDP 配置了站点 1、2 和 3,那么当应用程序重定向到 IDP 时,将出现一个 HRD 屏幕,要求用户从三个站点中选择一个。
用户选择一个,进行身份验证并通过 IDP 重定向回应用程序。
这不是协议功能——更像是 IDP 功能——因为它执行此操作与协议无关。
你的问题有两个问题:
服务提供商 (Site1) 需要将用户重定向到 "owns" 用户身份(可以验证他们)
在身份提供者处进行身份验证并将此事实传播回服务提供者
SAML 可以解决这两个问题,但请继续阅读以了解注意事项:
- SAML 中的一个配置文件是 Identity Provider Discovery 配置文件。它的定义来自 spec(第 4.3 节):
...a profile by which a service provider can
discover which identity providers a principal is using with the Web
Browser SSO profile. In deployments having more than one identity
provider, service providers need a means to discover which identity
provider(s) a principal uses. The discovery profile relies on a cookie
that is written in a domain that is common between identity providers
and service providers in a deployment. The domain that the deployment
predetermines is known as the common domain in this profile, and the
cookie containing the list of identity providers is known as the
common domain cookie.
如您所见,此配置文件依赖于 公共域 cookie,该 cookie 由 公共 上托管的发现服务发布(共享)域:
When a service provider needs to discover which identity providers a
principal uses, it invokes an exchange designed to present the common
domain cookie to the service provider after it is read by an HTTP
server in the common domain.
公共域(和关联的 cookie)要求是早期采用的,一些开发人员认为这不是满足每个人需求的优雅方法。这导致配置文件被修改并随后作为 separate specification 发布,称为 身份提供者发现服务协议和配置文件 。来自这个规范:
This specification defines a browser-based protocol by which a
centralized discovery service can provide a requesting service
provider with the unique identifier of an identity provider that can
authenticate a principal. The profile for discovery defined in section
4.3 of [SAML2Prof] is similar, but has different deployment properties, such as the requirement for a shared domain. Instead, this
profile relies on a normative, redirect-based wire protocol that
allows for independent implementation and deployment of the service
provider and discovery service components, a model that has proven
useful in some large-scale deployments in which managing common domain
membership may be impractical
提到大规模部署很重要。第一次尝试(基于 cookie 的配置文件)简单但混乱;改进后的规范完成了 "SAML way" 的所有工作...并大大增加了实施的复杂性。仅当您的身份提供者集合相当大时才值得这样做,例如您所在国家/地区的所有大学。
有许多非 SAML 选项可用于解决身份提供商发现问题。最简单的选择是 "ask the user" 通过采用用户体验友好的技术来 select 他们的身份提供者。这个blog does a good job of summarizing these options. For a real-world, complex solution to this problem take a look at Swiss universities' implementation.
- 这是 SAML 非常适合的常见场景。查看 SAML Technical Overview 了解更多详情。
注意:oAuth 不对用户进行身份验证,它对客户端应用程序进行身份验证。 OpenID Connect 基于 oAuth,它可以通过 id 令牌对用户进行身份验证。 id 令牌和相关的交换受到 SAML
的严重影响
我已经完成了一些 OpenID 集成,所以我知道我将要描述的问题是 OpenID 和 OAuth 可以解决的问题,但我是 SAML 的新手,并且试图将我的头脑集中在一个特定的用途上案例:
因此,假设用户访问 Site1,它要求用户确认他或她属于其他网站中的哪一个(Site2、Site3 等)
站点 1 无法对用户进行身份验证并依赖站点 2 或站点 3 进行身份验证,因此它会向用户提供一个站点列表以进行身份验证。
用户选择 Site2 或 Site3,在那里执行身份验证并重定向回 Site1。站点 1 确认用户并且它现在知道用户来自哪里。
问题:这是 SAML 要解决的有效问题吗?
IDP 通过 Home Realm Discovery 处理此问题。
如果 IDP 配置了站点 1、2 和 3,那么当应用程序重定向到 IDP 时,将出现一个 HRD 屏幕,要求用户从三个站点中选择一个。
用户选择一个,进行身份验证并通过 IDP 重定向回应用程序。
这不是协议功能——更像是 IDP 功能——因为它执行此操作与协议无关。
你的问题有两个问题:
服务提供商 (Site1) 需要将用户重定向到 "owns" 用户身份(可以验证他们)
在身份提供者处进行身份验证并将此事实传播回服务提供者
SAML 可以解决这两个问题,但请继续阅读以了解注意事项:
- SAML 中的一个配置文件是 Identity Provider Discovery 配置文件。它的定义来自 spec(第 4.3 节):
...a profile by which a service provider can discover which identity providers a principal is using with the Web Browser SSO profile. In deployments having more than one identity provider, service providers need a means to discover which identity provider(s) a principal uses. The discovery profile relies on a cookie that is written in a domain that is common between identity providers and service providers in a deployment. The domain that the deployment predetermines is known as the common domain in this profile, and the cookie containing the list of identity providers is known as the common domain cookie.
如您所见,此配置文件依赖于 公共域 cookie,该 cookie 由 公共 上托管的发现服务发布(共享)域:
When a service provider needs to discover which identity providers a principal uses, it invokes an exchange designed to present the common domain cookie to the service provider after it is read by an HTTP server in the common domain.
公共域(和关联的 cookie)要求是早期采用的,一些开发人员认为这不是满足每个人需求的优雅方法。这导致配置文件被修改并随后作为 separate specification 发布,称为 身份提供者发现服务协议和配置文件 。来自这个规范:
This specification defines a browser-based protocol by which a centralized discovery service can provide a requesting service provider with the unique identifier of an identity provider that can authenticate a principal. The profile for discovery defined in section 4.3 of [SAML2Prof] is similar, but has different deployment properties, such as the requirement for a shared domain. Instead, this profile relies on a normative, redirect-based wire protocol that allows for independent implementation and deployment of the service provider and discovery service components, a model that has proven useful in some large-scale deployments in which managing common domain membership may be impractical
提到大规模部署很重要。第一次尝试(基于 cookie 的配置文件)简单但混乱;改进后的规范完成了 "SAML way" 的所有工作...并大大增加了实施的复杂性。仅当您的身份提供者集合相当大时才值得这样做,例如您所在国家/地区的所有大学。
有许多非 SAML 选项可用于解决身份提供商发现问题。最简单的选择是 "ask the user" 通过采用用户体验友好的技术来 select 他们的身份提供者。这个blog does a good job of summarizing these options. For a real-world, complex solution to this problem take a look at Swiss universities' implementation.
- 这是 SAML 非常适合的常见场景。查看 SAML Technical Overview 了解更多详情。
注意:oAuth 不对用户进行身份验证,它对客户端应用程序进行身份验证。 OpenID Connect 基于 oAuth,它可以通过 id 令牌对用户进行身份验证。 id 令牌和相关的交换受到 SAML
的严重影响