# 单点登录

融租易目前支持单点登录成功后，可以跳转至登录前的URL。

> 注意系统管理-系统配置页面的配置项---登录成功跳转URL。默认设置为/index，则可以自动跳转至登录前的URL，如果改为自定义的其他页面，则会带上?targetUrl=xxx参数先跳转至系统配置的URL，可自行处理跳转。

可以配置CAS和标准登录并存，默认登录页面为SSO登录页面，访问/login，则可以进入标准登录页面。可以参照如下配置：

修改spring/casSecurity.xml

1.添加用于标准登录的相关bean
```xml
<beans:bean id="loginFailureHandler" class="com.hand.hap.security.LoginFailureHandler"/>
<beans:bean id="captchaVerifierFilter" class="com.hand.hap.security.CaptchaVerifierFilter"> <beans:property name="captchaField" value="verifiCode"/></beans:bean>

```

2.修改认证配置

```xml

<!-- CAS 认证配置 -->
<http entry-point-ref="casEntryPoint" access-decision-manager-ref="accessDecisionManager" >
 <csrf disabled="true"/>
 <intercept-url pattern="/resources/**" access="permitAll" />
 <intercept-url pattern="/lib/**" access="permitAll" />
 <intercept-url pattern="/common/**" access="permitAll" />
 <intercept-url pattern="/login" access="permitAll" /> <intercept-url pattern="/verifiCode" access="permitAll" />
 <intercept-url pattern="/login.html" access="permitAll" />
 <intercept-url pattern="/**" access="hasRole('ROLE_USER')" /> <form-login login-page='/login' authentication-success-handler-ref="successHandler" authentication-failure-handler-ref="loginFailureHandler"/>
 <!-- 验证码拦截器 -->
 <custom-filter ref="captchaVerifierFilter" before="FORM_LOGIN_FILTER"/> <custom-filter ref="requestSingleLogoutFilter" before="LOGOUT_FILTER"/>
 <custom-filter position="CAS_FILTER" ref="casFilter" />
 <custom-filter ref="singleLogoutFilter" before="CAS_FILTER"/>
 <headers defaults-disabled="true">
 <cache-control/>
 </headers>
</http>
```

3.添加authentication-provider
```xml

<authentication-manager alias="authenticationManager">
  <authentication-provider ref="casAuthenticationProvider"/>
  <authentication-provider user-service-ref="customUserDetailsService">
  <password-encoder ref="passwordManager"/>
  </authentication-provider>
</authentication-manager>
```


