CAS OAuth与谷歌

时间:2013-11-29 12:15:16

标签: oauth google-oauth cas

我想将CAS 3.5.2与Google Oauth一起使用 - 所以我的配置与此完全相同: https://wiki.jasig.org/display/CASUM/Configuration+for+the+OAuth+client+support+in+CAS+server+version+%3E%3D+3.5.1

我还包括: CAS服务器支持,OAuth的3.5.2.jar 划线向上1.2.0.jar

但我仍然收到以下错误,不知道我做错了什么:

2013-11-29 12:42:45,519 ERROR [org.springframework.web.context.ContextLoader] - <Context     initialization failed>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name     'google' defined in ServletContext resource [/WEB-INF/spring-    configuration/applicationContext.xml]: Instantiation of bean failed; nested exception is     java.lang.NoClassDefFoundError: org/scribe/model/OAuthRequest
    at     org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized_aroundBody0(SafeContextLoaderListener.java:75)
at org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized_aroundBody1$advice(SafeContextLoaderListener.java:57)
at org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized(SafeContextLoaderListener.java:1)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoClassDefFoundError: org/scribe/model/OAuthRequest
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.getDeclaredConstructor(Class.java:2053)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:67)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
... 29 more
Caused by: java.lang.ClassNotFoundException: org.scribe.model.OAuthRequest
    at     org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
    at     org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    ... 35 more

在我的applicationContext.xml中我添加了:

<bean id="google" class="org.scribe.up.provider.impl.GoogleProvider">
 <property name="key" value="myvalue" />
 <property name="secret" value="mysecret" />
</bean>

<bean id="oauthConfig" class="org.jasig.cas.support.oauth.OAuthConfiguration">
  <property name="loginUrl" value="https://my.login.com/login" />
  <property name="providers">
    <list>
      <ref bean="google" />
    </list>
  </property>
 </bean>

我错过了什么?????

谢谢!!

1 个答案:

答案 0 :(得分:0)

我是 scribe-up cas-server-support-oauth 库的创建者。文档准确无误。我有一个测试OAuth支持的演示:https://github.com/leleuj/cas-oauth-demo-3.5.x

也就是说,您遇到错误:ClassNotFoundException: org.scribe.model.OAuthRequest表示缺少 Scribe 库(由 scribe-up 使用)(版本1.3.2是需要)。这不应该发生,因为它是一个依赖:http://search.maven.org/remotecontent?filepath=org/scribe/scribe-up/1.2.0/scribe-up-1.2.0.pom