Java SSO OAuth2身份验证会话和服务器端http请求

Java SSO OAuth2身份验证会话和服务器端http请求,java,http,cookies,language-agnostic,single-sign-on,Java,Http,Cookies,Language Agnostic,Single Sign On,我对有机会向实现相同SSO身份验证的web服务器发出服务器端http请求感兴趣 因此,假设我有:hello.org和hey.com指向同一个SSO服务器。 登录hello.org后,我获得: OAuth2Authentication authenticationObject = (OAuth2Authentication) principal; 现在我想从hello.org服务器向hey.com Request.Get("hey.com/get_data").execute().return

我对有机会向实现相同SSO身份验证的web服务器发出服务器端http请求感兴趣

因此,假设我有:hello.orghey.com指向同一个SSO服务器。 登录hello.org后,我获得:

OAuth2Authentication authenticationObject = (OAuth2Authentication) principal; 
现在我想从hello.org服务器向hey.com

Request.Get("hey.com/get_data").execute().returnContent().asString(); 
但我遇到了身份验证错误代码401


如何从OAuth对象中检索所有必需的令牌并使我的请求得到验证

网站hello.org不应该使用提供给调用hello.org的客户端的令牌调用hey.com。该令牌将被视为经过身份验证的用户和hello.org之间的契约

hello.org服务器需要有自己的客户机授权访问hey.com

因此,解决此问题的一种常见方法是创建一个“hello.org to hey.com”客户端,使用针对sso提供程序的密钥或证书身份验证,然后使用此处提供的令牌调用hey.com,然后将信息转发回hello.org的用户

现在,如果你想通过hello.org给hey.com打电话,而用户不知道hey.com曾经参与过信息提供

另一方面,如果您想让用户通过hello.org登录来访问hello.org和hey.com,您应该签出OpenId或SAML,因为裸体Oauth并不是真正为SSO或资源共享而设计的