2017-07-27 49 views
0

我想弄清楚如何使用WSO2 Identity Server为我的应用程序设置SSO。我的使用案例是我有2个应用程序使用WSO2IS通过OAuth/OpenId Connect进行保护。如果我登录到应用程序1,则启动应用程序2应该自动登录。该流程应该是什么?WSO2IS OAuth/OpenId连接SSO设置

目前,我创建了2个服务提供者,每个应用程序一个。每个服务提供商入站认证配置均使用OAuth/OpenId Connect进行配置。我还需要做什么?我已经关注https://docs.wso2.com/display/IS530/Configuring+OAuth2-OpenID+Connect+Single-Sign-On。我被成功重定向到IS进行登录,每个应用程序都能够获得访问令牌和JWT。不过,我被要求分别登录每个应用程序---当我访问应用程序2时没有自动登录。

谢谢!

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

< < <应用1 >>>

[2017年7月27日21:30:17117] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 验证为CLIENT_ID客户信息请求: L7c7Zqf9QpDKjyEtOQ74R__RSy0a和callback_uri http://[hostname]:[8080]/xxxx/ [2017年7月27日21:30:17124] DEBUG {} org.wso2.carbon.identity.oauth2.OAuth2Service - 注册应用程序发现对于给定的客户ID:L7c7Zqf9QpDKjyEtOQ74R__RSy0a,应用程序名称:应用程序1,回调URL :http://[hostname]:[8080]/xxxx/ [2017-07-27 21:30:30,506] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 用户收到的授权请求:[email protected],客户端ID: L7c7Zqf9QpDKjyEtOQ74R__RSy0a,授权响应类型:代码,请求回调URI:http://[hostname]:[8080]/xxxx/,请求范围:email 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} - 颁发授权码给用户:[email protected],使用重定向url:http://[hostname]:[8080]/xxxx/,范围:email openid配置文件,有效期限:300000 [2017-07-27 21:30:30,510] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 已清除OAuthAuthzReqMessageContext [2017 -07-27 21:30:30,756] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 接收到的客户端ID令牌请求L7c7Zqf9QpDKjyEtOQ74R__RSy0a,用户ID为空,范围:[]和授予类型:授权代码 [2017-07-27 21:30:30,756] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.Abs​​tractClientAuthHandler} - 可以使用客户端ID和Secret进行身份验证。客户端ID:L7c7Zqf9QpDKjyEtOQ74R__RSy0a [2017-07-27 21:30:30,756] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.Abs​​tractClientAuthHandler} - 授予类型: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,授权用户:[email protected],范围:电子邮件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] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 已清除OAuthTokenReqMessageContext [2017-07-27 21:30: 30759] DEBUG {} org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer - 颁发给客户端ID访问令牌:L7c7Zqf9QpDKjyEtOQ74R__RSy0a用户名:[email protected]和范围:电子邮件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} - 为用户接收授权请求:[email protected],客户端ID:fwM8a593OUxufW2ZaBXYx9f1mREa,授权响应类型:代码,请求URI回调:http://[hostname]:[8090]/xxxx/,请求范围:电子邮件的OpenID个人资料 [2017-07-27 21:30:55,455] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 增加了OAuthAuth zReqMessageContext到ThreadLocal的 [2017年7月27日21:30:55457] DEBUG {org.wso2.carbon.identity.oauth2.authz.handlers.CodeResponseTypeHandler} - 分授权码到用户:[email protected],使用重定向url:http://[hostname]:[8090]/xxxx/,范围:email openid配置文件,有效期限:300000 [2017-07-27 21:30:55,458] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 已清除OAuthAuthzReqMessageContext [2017- 07-27 21:30:55739] DEBUG {org.wso2.carbon.identity.oauth2.OAuth2Service} - 访问令牌的客户端ID fwM8a593OUxufW2ZaBXYx9f1mREa,用户ID为空,范围接收到的请求:[]和Grant类型:authorization_code [2017- 07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.Abs​​tractClientAuthHandler} - 可以使用客户端ID和Secret进行身份验证。客户端ID:fwM8a593OUxufW2ZaBXYx9f1mREa [2017-07-27 21:30:55,739] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.clientauth.Abs​​tractClientAuthHandler} - 授予类型: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,授权用户:[email protected],范围:电子邮件OpenID的轮廓 [2017年7月27日21:30:55740] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - 增加OAuthTokenReqMessageContext到的ThreadLocal [2017年7月27日21:30:55740] DEBUG {org.wso2.carbon.identity。 oauth2.to ken.handlers.grant.AbstractAuthorizationGrantHandler} - 无限寿命访问令牌在高速缓存中发现 a01c94d9-c889-3a38-a67e-38a7f0350aa0 [2017年7月27日21:30:55740] 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 username:testuser @ carbon 。超级和示波器:电子邮件openid配置文件

+0

什么配置为每个应用程序的出站鉴定人? – farasath

+0

您的应用程序是否在localhost域上运行?最近,Chrome已经做出了一项改变,防止了为本地主机发回的cookie设置。因此,我可以建议的一件事就是将您的应用设置为两个域名,例如abc.com和xyz.com,并尝试相同。 – farasath

+0

https://docs.wso2.com/display/IS530/Basic+Client+Profile+with+Playground – farasath

回答

0

下一步是设置您的客户端应用程序,该应用程序将尝试使用OpenID Connect向WSO2认证用户。请按照下列步骤:

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

一旦完成,创建应用程序的副本和不同的端口上运行,并与SSO和SLO玩。一个例子是这样的:

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

+0

谢谢,阿甘!我已经编辑了我的问题,包括我有客户端应用程序使用IS进行身份验证和获取访问令牌的事实。只是在登录到应用程序1之后,我仍然被要求在访问应用程序2时登录。任何想法出错了? – Leo

+0

这不应该发生在第一个地方。我有几个问题,但在这两个应用程序中,wso2的URL是相同的?您的浏览器是否启用cookies?您是否试图在同一窗口中打开应用程序(不使用隐身或隐私浏览的第二个应用程序??) – Agam

+0

是的,这两个应用程序具有相同的wso2is网址和端口号。最初,Cookie未启用,但我启用了它。我尝试过使用Chrome浏览器和FF浏览器,并退出浏览器以确保设置生效。我没有使用隐身或隐私浏览第二个应用程序...尝试新标签和现有标签。 – Leo