Now, I am trying to add the authentication with Google using OAuth 2.0. For that, I am using Google2Provider by updating the dependency on scribe-up to 1.3.1.
But the following error is thrown upon accessing CAS login page:
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)
...
It appears the exception is caused by a null "scope" of the config parameter in GoogleApi20.getAuthorizationUrl(final OAuthConfig config) where config.getScope() returns null:
public String getAuthorizationUrl(final OAuthConfig config) {
return String.format(AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),
OAuthEncoder.encode(config.getScope()));
}