CAS SSO服务器中的代码过期

时间:2012-10-28 18:04:58

标签: login oauth single-sign-on cas

我使用OAuth协议支持部署了我的CAS服务器

我已将此代码添加到我的deployerConfigContext.xml

<bean class="org.jasig.cas.services.RegisteredServiceImpl">
    <property name="id" value="1"/>
    <property name="name" value="the_key"/>
    <property name="description" value="the_secret"/>
    <property name="theme" value="my great webapp for OAuth"/>
    <property name="serviceId" value="http://localhost:8080/cas/login"/>
    <property name="evaluationOrder" value="10000001"/>
    <property name="allowedAttributes">
        <list>
            <!-- facebook -->
            <value>the_key</value>
            <value>the_secret</value>
        </list>
    </property>
</bean>     

<bean id="ticketRegistry" class="org.jasig.cas.ticket.registry.DefaultTicketRegistry">
    <constructor-arg index="0" value="1000"/>
    <constructor-arg index="1" value="1"/>
    <constructor-arg index="2" value="16"/>
</bean>

定义我的ticketRegistry 所以我的OAuth客户端密码密钥是the_secret和the_key

但是当我加载此网址http://localhost:8080/cas/oauth2.0/accessToken?client_secret=the_secret&grant_type=refresh_token&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcas%2Flogin&code=0&client_id=the_key来测试我的OAuth协议时,我发现了此异常

<Code Expired 0>

为什么以及如何解决?

1 个答案:

答案 0 :(得分:1)

您需要定义两个CAS服务:

  1. 一个用于OAuth服务器支持的内部机制(使用CASservice.serviceId = http://localhost:8080/cas/oauth2.0/callbackAuthorize
  2. 您要授权的每个客户端OAuth应用程序一个(使用oauthclient.key = CASservice.name,oauthclient.secret = CASservice.description,oauthclient.redirect_uri应以CASservice.serviceId开头)。
  3. 文档:https://wiki.jasig.org/display/CASUM/OAuth+server+support,第3部分......