2015-07-10 52 views
0

我有一個cas服務器,它可以正確地認證併發送一些屬性。現在我想添加一個服務來檢查主體屬性中的用戶角色,並且只有當登錄用戶具有特定角色(如管理員角色!)時才允許訪問服務。允許在cas中的特定角色

我讀了'requiredHandlers',並認爲它可以幫助,但我無法使它工作!

對於服務,我有這樣的事情:

<bean class="org.jasig.cas.services.RegexRegisteredService"> 
     <property name="id" value="1"/> 
     <property name="name" value="Admin panel service"/> 
     <property name="serviceId" value="http://localhost:8080/admin"/> 
     <property name="evaluationOrder" value="0"/> 
     <property name="ignoreAttributes" value="true"/> 
     <property name="requiredHandlers" value="supporterAuthenticationHandler"> <!-- this is what i found so far --> 
     </property> 
    </bean> 

其中supporterAuthenticationHandlerauthenticationManager

<bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager"> 
    <constructor-arg> 
     <map> 
      <entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver"/> 
      <entry key-ref="primaryAuthenticationHandler"><null /></entry> 
      <entry key-ref="supporterAuthenticationHandler"><null /></entry> 
     </map> 
    </constructor-arg> 

    <property name="authenticationPolicy"> 
     <bean class="org.jasig.cas.authentication.AnyAuthenticationPolicy"/> 
    </property> 
</bean> 

而且supporterAuthenticationHandler定義是的AuthenticationHandler(什麼也沒有實現又一個簡單的FPGA實現

問題是我不能讓cas來檢查supporterAuthenticationHandler所以我可以走得更遠(可能會陷入另一個需要具有屬性的新主體的洞)。

我完全錯了嗎?我應該在我的管理員應用程序中檢查用戶角色嗎?是否有可能通過不同的服務檢查角色?

回答

0

這就意味着CAS是一種認證服務而不是授權服務。 CAS僅確保用戶是他們所說的他們不是他們在應用程序(服務)中可以做的事情。

請參閱此答案

https://security.stackexchange.com/questions/7623/can-central-authentication-service-cas-do-authorization

+0

我我想知道我用CAS作爲授權。好。這是一個授權,但我想爲整個服務做,而不僅僅是它的一部分。我已經在某處讀過它,但無法再找到它。 CAS必須能夠以某種方式授權訪問特殊服務。 (現在我檢查服務端的服務授權) – alizelzele

+0

根據你的問題,它是授權。身份驗證只能確認用戶不在安全系統中扮演什麼角色。你將不得不建立一個完整的授權系統來做你想做的事情。當已經有系統進行授權和認證時,爲什麼要經歷這些麻煩。 –

相關問題