2012-02-21 106 views
8

我跟着鏈接http://lukesampson.com/post/315838839/cas-on-windows-localhost-setup-in-5-mins,那麼CAS服務器工作正常,登錄網址是http://10.1.1.26:8080/login,驗證URL是http://10.1.1.26:8080/serviceValidateCAS服務票證驗證失敗

然後,我測試了它象下面這樣:

  1. 呼叫http://10.1.1.26:8080/login?service=http://10.1.1.9:8081/default.aspx
  2. 我得到的服務票據成功,如ST-9-pJ5UDxqKIHP2zuN3JGe4-CAS
  3. 然後我通過調用http://10.1.1.26:8080/serviceValidate?ticket=ST-9-pJ5UDxqKIHP2zuN3JGe4-cas&service=http://10.1.1.9:8081/default.aspx驗證服務票證,
  4. 不幸的是,它總是返回無效票,

in爲了解決這個問題,我嘗試了cas 1.0驗證url,http://10.1.1.26:8080/validate?ticket=ST-9-pJ5UDxqKIHP2zuN3JGe4-cas&service=http://10.1.1.9:8081/default.aspx,但它返回「no」。

然後,我生成一個證書文件,並將其放入密鑰庫,然後我嘗試了所有上述步驟,使用https://10.1.1.26:8443,但是,驗證仍然失敗。

我改變了CAS log4j的配置,打印所有調試信息,以下是日誌

2012-02-21 13:18:36,371 DEBUG [org.springframework.web.servlet.DispatcherServlet 
] - <DispatcherServlet with name 'cas' processing GET request for [/cas-server-w 
ebapp-3.4.11/serviceValidate]> 
2012-02-21 13:18:36,381 DEBUG [org.springframework.webflow.mvc.servlet.FlowHandl 
erMapping] - <No flow mapping found for request with URI '/cas-server-webapp-3.4 
.11/serviceValidate'> 
2012-02-21 13:18:36,381 DEBUG [org.springframework.web.servlet.handler.SimpleUrl 
HandlerMapping] - <Mapping [/serviceValidate] to HandlerExecutionChain with hand 
ler [[email protected]] and 1 interceptor> 
2012-02-21 13:18:36,381 DEBUG [org.springframework.web.servlet.DispatcherServlet 
] - <Last-Modified value for [/cas-server-webapp-3.4.11/serviceValidate] is: -1> 
2012-02-21 13:18:36,391 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - 
<ServiceTicket [ST-1-pqIeCRqcafGBE6idoCcd-cas] has expired.> 
2012-02-21 13:18:36,391 INFO [com.github.inspektr.audit.support.Slf4jLoggingAudi 
tTrailManager] - <Audit trail record BEGIN 
============================================================= 
WHO: audit:unknown 
WHAT: ST-1-pqIeCRqcafGBE6idoCcd-cas 
ACTION: SERVICE_TICKET_VALIDATE_FAILED 
APPLICATION: CAS 
WHEN: Tue Feb 21 13:18:36 EST 2012 
CLIENT IP ADDRESS: 10.1.1.9 
SERVER IP ADDRESS: 10.1.1.26 
============================================================= 

什麼我不明白,不知道爲什麼從其他文章中,我看到了日誌有什麼就像「寫入服務票到票務註冊,並檢索服務票」,但沒有什麼關於在我的日誌

回答

18

我不是100%確定,因爲我看不到你的配置,但日誌說這個

<ServiceTicket [ST-1-pqIeCRqcafGBE6idoCcd-cas] has expired.> 

這意味着票證已經過期。 CAS中存在一個名爲ticketExpirationPolicies.xml的配置文件,其中包含票證有效的時間。在我的CAS版本中,服務票據的到期期限設置爲10000毫秒。也許你們之間的時間步驟1和3是長於文件(當然)的過期設置可能不同於礦山

<!-- Expiration policies --> 
<bean id="serviceTicketExpirationPolicy" class="org.jasig.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy"> 
    <!-- This argument is the number of times that a ticket can be used before its considered expired. --> 
    <constructor-arg 
     index="0" 
     value="1" /> 

    <!-- This argument is the time a ticket can exist before its considered expired. --> 
    <constructor-arg 
     index="1" 
     value="10000" /> 
</bean> 

<bean id="grantingTicketExpirationPolicy" class="org.jasig.cas.ticket.support.TimeoutExpirationPolicy"> 
    <!-- This argument is the time a ticket can exist before its considered expired. --> 
    <constructor-arg 
     index="0" 
     value="7200000" /> 
</bean> 

,你在我看來,按照教程是不是在它的配置設置完成。根據您嘗試使用此CAS服務器實現的功能,您可能需要一些描述的定製here

+0

與此處相同的問題顯然默認過期時間非常短。我改變了,它的工作。 – 2015-12-12 18:51:51