我已经成功地将我的CAS v.3.5.2配置为使用OAuth 1.0将身份验证委托给雅虎,通过遵循https://wiki.jasig.org/display/CASUM/Configuration+for+the+OAuth+client+support+in+CAS+server+version+%3E%3D+3.5.1上的Jasig指令,我正在尝试使用OAuth 2.0添加OAuth身份验证。为此,我正在使用Google2Provider,方法是更新对划线员的依赖--最多为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配置)中的配置参数的空“作用域”引起的,其中config.getScope()返回null:
public String getAuthorizationUrl(final OAuthConfig config) {
return String.format(AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),
OAuthEncoder.encode(config.getScope()));
} 那么,是否有可能通过使用OAuth 1.0对雅虎进行身份验证,而在OAuth 2.0中同时使用OAuth 2.0进行身份验证呢?有没有一个例子可以说明这是如何做到的?
提前谢谢你。
发布于 2013-07-06 18:39:56
我是CAS中OAuth客户端支持的创建者。实际上,Google2Provider中存在一个错误:默认范围为null。使用适当的setter:setScope(final Google2Scope scope)来解决问题.
https://stackoverflow.com/questions/17494412
复制相似问题