2010-08-16 60 views
1

我有Spring安全3.0.3與CAS。我的一些CONF的如下:如何創建spring cas登錄鏈接

<security:http entry-point-ref="casAuthenticationEntryPoint" auto-config="true" > 
    <security:intercept-url pattern="/*/secure/**" access="ROLE_USER" /> 
    <security:custom-filter position="CAS_FILTER" ref="casAuthenticationFilter" /> 
    <security:anonymous enabled="false"/> 
    <security:logout invalidate-session="true" logout-url="/logout" logout-success-url="/web/auth?logout" /> 
</security:http> 

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint"> 
    <property name="loginUrl" value="${cas.app.url}/login"></property> 
    <property name="serviceProperties" ref="serviceProperties"></property> 
</bean> 

<bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties"> 
    <property name="service" value="${application.stack.hostname}/ctx/j_spring_cas_security_check" /> 
    <property name="sendRenew" value="false" /> 
</bean> 

如果我訪問一些安全的內容我重定向到CAS登錄。身份驗證後,我被重定向回到我試圖訪問的安全網址。

在每一頁我需要添加「登錄」鏈接,做同樣的事情。這個鏈接應該指向哪裏?我試過$ {cas.app.url}/login?service = $ {application.stack.hostname}/ctx/j_spring_cas_security_check,但這似乎不起作用。

當然的所有屬性都與相應的充分的主機名代替:)

回答

0

它可以指向匹配模式<security:intercept-url pattern="/*/secure/**" access="ROLE_USER" />

0

任何URL如果我明白你正在尋找你應該能夠指出他們到$ {cas.app.url} /登錄。退出服務參數。這會將它們帶到您的cas服務器的登錄頁面,該服務器將對您的所有安全服務進行身份驗證。