WSO2IS OAuth/OpenId 连接 SSO 设置

WSO2IS OAuth/OpenId Connect SSO Setup

我正在尝试弄清楚如何使用 WSO2 Identity Server 为 SSO 设置我的应用程序。我的用例是我有 2 个应用程序由 OAuth/OpenId 使用 WSO2IS 连接保护。如果我登录到应用程序 1,那么启动应用程序 2 应该会自动让我登录。流程应该是什么?

目前,我已经创建了 2 个服务提供者,每个应用程序一个。每个服务提供商入站身份验证配置都是使用 OAuth/OpenId 连接配置的。我还需要做什么?

我关注了 https://docs.wso2.com/display/IS530/Configuring+OAuth2-OpenID+Connect+Single-Sign-On。我成功地被重定向到 IS 进行登录,并且每个应用程序都能够获得访问令牌和 JWT。但是,我被要求分别登录每个应用程序---当我访问应用程序 2 时没有自动登录。

谢谢!

WSO2IS 输出,当我登录到应用程序 1,然后在同一浏览器和选项卡中登录应用程序 2。

<<< 申请 1 >>>

[2017-07-27 21:30:17,117] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 验证 client_id 的客户端信息请求:L7c7Zqf9QpDKjyEtOQ74R__RSy0a和 callback_uri http://[hostname]:[8080]/xxxx/ [2017-07-27 21:30:17,124] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 为给定客户端 ID 找到的注册应用程序:L7c7Zqf9QpDKjyEtOQ74R__RSy0a,应用程序名称:Application1,回调URL : http://[hostname]:[8080]/xxxx/ [2017-07-27 21:30:30,506] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 收到用户授权请求:testuser@carbon.super,客户端 ID:L7c7Zqf9QpDKjyEtOQ74R__RSy0a、授权响应类型:代码、请求的回调 URI:http://[hostname]:[8080]/xxxx/、请求的范围:电子邮件 openid 配置文件 [2017-07-27 21:30:30,507] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 添加 OAuthAuthzReqMessageContext 到 threadlocal [2017-07-27 21:30:30,508] DEBUG {org.wso2.carbon.identity.oauth2.authz.handlers.CodeResponseTypeHandler} - 向用户发布授权码:testuser@carbon.super,使用重定向 url : http://[hostname]:[8080]/xxxx/, Scope : email openid profile, validity period : 300000 [2017-07-27 21:30:30,510] 调试 {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 已清除 OAuthAuthzReqMessageContext [2017-07-27 21:30:30,756] 调试 {org.wso2.carbon.identity.oauth2.OAuth2Service} - 收到客户端 ID L7c7Zqf9QpDKjyEtOQ74R__RSy0a、用户 ID 为空、范围:[] 的访问令牌请求和授权类型:authorization_code [2017-07-27 21:30:30,756] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.AbstractClientAuthHandler} - 可以使用客户端 ID 和 Secret 进行身份验证。客户端 ID:L7c7Zqf9QpDKjyEtOQ74R__RSy0a [2017-07-27 21:30:30,756] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.AbstractClientAuthHandler} - 授予类型:authorization_code 严格客户端验证设置为:null [2017-07-27 21:30:30,757] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 从数据库中获取了客户端凭据。 [2017-07-27 21:30:30,757] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 使用客户端 ID 成功验证了客户端:L7c7Zqf9QpDKjyEtOQ74R__RSy0a [2017-07-27 21:30:30,757] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler} - 授权代码信息在客户端 ID 的缓存中不可用:L7c7Zqf9QpDKjyEtOQ74R__RSy0a [2017-07-27 21:30:30,758] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler} - 找到授权码,客户端:L7c7Zqf9QpDKjyEtOQ74R__RSy0a,授权用户:testuser@carbon.super,范围:电子邮件 openid 配置文件 [2017-07-27 21:30:30,758] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 添加 OAuthTokenReqMessageContext 到 threadlocal [2017-07-27 21:30:30,759] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler} - 在缓存中找到无限生命周期访问令牌 c6d1b10e-cd51-379a-9162-4f5228aaa5dc [2017-07-27 21:30:30,759] 调试 {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 已清除 OAuthTokenReqMessageContext [2017-07-27 21:30:30,759] DEBUG {org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer} - 颁发给客户端 ID 的访问令牌:L7c7Zqf9QpDKjyEtOQ74R__RSy0a 用户名:testuser@carbon.super 和范围:电子邮件 openid 配置文件

<<< 申请 2 >>>

[2017-07-27 21:30:42,014] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 验证 client_id 的客户端信息请求:fwM8a593OUxufW2ZaBXYx9f1mREa 和 callback_uri http://[hostname]:[8090]/xxxx/ [2017-07-27 21:30:42,016] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 为给定客户端 ID 找到的注册应用程序:fwM8a593OUxufW2ZaBXYx9f1mREa,应用程序名称:Application2,回调 URL : http://[hostname]:[8090]/xxxx/ [2017-07-27 21:30:55,454] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 收到用户的授权请求:testuser@carbon.super,客户端 ID:fwM8a593OUxufW2ZaBXYx9f1mREa,授权响应类型:代码,请求的回调 URI:http://[hostname]:[8090]/xxxx/,请求的范围:电子邮件 openid 配置文件 [2017-07-27 21:30:55,455] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 添加 OAuthAuthzReqMessageContext 到 threadlocal [2017-07-27 21:30:55,457] DEBUG {org.wso2.carbon.identity.oauth2.authz.handlers.CodeResponseTypeHandler} - 向用户颁发授权码:testuser@carbon.super,使用重定向 url : http://[hostname]:[8090]/xxxx/, Scope : email openid profile, validity period : 300000 [2017-07-27 21:30:55,458] 调试 {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 已清除 OAuthAuthzReqMessageContext [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 收到客户端 ID fwM8a593OUxufW2ZaBXYx9f1mREa、用户 ID null、范围:[] 和授权类型:的访问令牌请求authorization_code [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.AbstractClientAuthHandler} - 可以使用客户端 ID 和 Secret 进行身份验证。客户端 ID:fwM8a593OUxufW2ZaBXYx9f1mREa [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.AbstractClientAuthHandler} - 授予类型:authorization_code 严格客户端验证设置为:null [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 从数据库中获取了客户端凭据。 [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 成功验证了客户端 ID 为:fwM8a593OUxufW2ZaBXYx9f1mREa 的客户端 [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler} - 授权码信息在客户端 ID 的缓存中不可用:fwM8a593OUxufW2ZaBXYx9f1mREa [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler} - 找到授权码,客户端:fwM8a593OUxufW2ZaBXYx9f1mREa,授权用户:testuser@carbon.super , 范围:电子邮件 openid 配置文件 [2017-07-27 21:30:55,740] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 添加 OAuthTokenReqMessageContext 到 threadlocal [2017-07-27 21:30:55,740] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler} - 在缓存中找到无限生命周期访问令牌 a01c94d9-c889-3a38-a67e-38a7f0350aa0 [2017-07-27 21:30:55,740] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 已清除 OAuthTokenReqMessageContext [2017-07-27 21:30:55,740] DEBUG {org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer} - 颁发给客户端 ID 的访问令牌:fwM8a593OUxufW2ZaBXYx9f1mREa 用户名:testuser@carbon.super 和范围: 电子邮件 openid 配置文件

下一步是设置您的客户端应用程序,它将尝试使用 OpenID Connect 对 WSO2 用户进行身份验证。请按照以下步骤操作:

https://docs.wso2.com/display/IS530/OpenIDConnect

完成后,在不同的端口上创建您的应用程序和 运行 的副本,然后使用 SSO 和 SLO。一个例子是这样的:

https://docs.wso2.com/display/IS530/Configuring+OpenID+Connect+Single+Logout

您可以通过阅读 Enabling Authentication Session Persistence 来了解 WSO2 IS 如何维护 SSO 会话的机制。