Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Google OAuth 2.0和Yahoo OAuth 1.0进行CAS OAuth身份验证_Oauth_Google Oauth_Cas - Fatal编程技术网

使用Google OAuth 2.0和Yahoo OAuth 1.0进行CAS OAuth身份验证

使用Google OAuth 2.0和Yahoo OAuth 1.0进行CAS OAuth身份验证,oauth,google-oauth,cas,Oauth,Google Oauth,Cas,我已成功配置我的CAS v。3.5.2按照Jasig CAS Wiki上的说明,使用OAuth 1.0将身份验证委托给Yahoo 现在,我正在尝试使用OAuth2.0添加与Google的身份验证。为此,我使用Google2Provider将对scribe的依赖项更新到1.3.1。但在访问CAS登录页面时引发以下错误: SEVERE: Servlet.service() for servlet [cas] in context with path [/cas] threw exception [R

我已成功配置我的CAS v。3.5.2按照Jasig CAS Wiki上的说明,使用OAuth 1.0将身份验证委托给Yahoo 现在,我正在尝试使用OAuth2.0添加与Google的身份验证。为此,我使用Google2Provider将对scribe的依赖项更新到1.3.1。但在访问CAS登录页面时引发以下错误:

SEVERE: Servlet.service() for servlet [cas] in context with path [/cas] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.jasig.cas.support.oauth.web.flow.OAuthAction@4d88f286 in state 'oauthAction' of flow 'login' -- action execution attributes were 'map[[empty]]'] with root cause
java.lang.IllegalArgumentException: Cannot encode null object
at org.scribe.utils.Preconditions.check(Preconditions.java:82)
at org.scribe.utils.Preconditions.checkNotNull(Preconditions.java:29)
at org.scribe.utils.OAuthEncoder.encode(OAuthEncoder.java:28)
at org.scribe.up.addon_to_scribe.GoogleApi20.getAuthorizationUrl(GoogleApi20.java:36)
at org.scribe.oauth.OAuth20ServiceImpl.getAuthorizationUrl(OAuth20ServiceImpl.java:69)
at org.scribe.up.provider.BaseOAuth20Provider.getAuthorizationUrl(BaseOAuth20Provider.java:43)
at org.jasig.cas.support.oauth.web.flow.OAuthAction.doExecute(OAuthAction.java:128)

异常似乎是由GoogleApi20.getAuthorizationUrl(最终OAuthConfig配置)中配置参数的null“scope”引起的,其中config.getScope()返回null:

public String getAuthorizationUrl(final OAuthConfig config) {
    return String.format(AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),
                         OAuthEncoder.encode(config.getScope()));
} 
那么,通过在CAS中同时使用OAuth 1.0和OAuth 2.0与Yahoo进行身份验证,是否有可能实现这一点?是否有一个例子说明如何做到这一点


提前感谢您。

我是CAS中OAuth客户端支持的创建者。事实上,Google2Provider中存在一个bug:默认范围为null。使用合适的setter设置一个真正的范围:
setScope(最终的谷歌2范围)
来解决问题…

Ah,就像我花了一天时间调试后所怀疑的那样。谢谢杰罗姆的确认!由于此错误阻止加载CAS登录视图,您建议我在何处使用实际作用域调用setScope?顺便说一句,我曾尝试将其注入到applicationContext.xml中的GoogleBean定义中,如“…”,但没有成功。谢谢。在仔细研究了源代码之后,我想到了在哪里设置一个真正的作用域。我要试试。像这样的东西应该有用。。。