Diferencia entre revisiones de «HOW TO: Integración CAS»
(Página creada con «{{Languages}} = '''HOW TO: Configurar la integración con CAS (JASIG Central Authentication Service)''' = La plataforma permite integrarse con CAS de manera transparent...») |
(→HOW TO: Configurar la integración con CAS (JASIG Central Authentication Service)) |
||
Línea 38: | Línea 38: | ||
El contenido del archivo CAS es el siguiente: | El contenido del archivo CAS es el siguiente: | ||
− | |||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
Línea 49: | Línea 48: | ||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> | http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> | ||
<bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy"> | <bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy"> | ||
− | + | <property name="filterInvocationDefinitionSource"> | |
− | + | <value> | |
− | + | CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON | |
− | + | PATTERN_TYPE_APACHE_ANT | |
− | + | /**=httpSessionContextIntegrationFilter,casSingleSignOutFilter,casProcessingFilter,securityContextHolderAwareRequestFilter,exceptionTranslationFilter,zkEventExceptionFilter,filterInvocationInterceptor | |
− | + | </value> | |
− | + | </property> | |
− | + | </bean> | |
− | + | <bean id="exceptionTranslationFilter" class="org.springframework.security.ui.ExceptionTranslationFilter"> | |
− | + | <property name="authenticationEntryPoint"> | |
− | + | <bean id="casProcessingFilterEntryPoint" class="org.springframework.security.ui.cas.CasProcessingFilterEntryPoint"> | |
− | + | <property name="loginUrl" value="${cas.server.login}"/> | |
− | + | <property name="serviceProperties" ref="serviceProperties"/> | |
− | + | </bean> | |
− | + | </property> | |
− | + | </bean> | |
− | + | <!-- Does the CAS ticket validation and user details loading --> | |
− | + | <bean id="casAuthenticationProvider" class="org.springframework.security.providers.cas.CasAuthenticationProvider"> | |
− | + | ||
<property name="userDetailsService" ref="userDetailsService"/> | <property name="userDetailsService" ref="userDetailsService"/> | ||
<property name="serviceProperties" ref="serviceProperties"/> | <property name="serviceProperties" ref="serviceProperties"/> | ||
<property name="ticketValidator"> | <property name="ticketValidator"> | ||
− | + | <bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator"> | |
− | + | <constructor-arg index="0" value="${cas.server}"/> | |
− | + | </bean> | |
</property> | </property> | ||
<property name="key" value="my_password_for_this_auth_provider_only"/> | <property name="key" value="my_password_for_this_auth_provider_only"/> | ||
</bean> | </bean> | ||
− | + | <bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager"> | |
− | + | <property name="providers"> | |
− | + | <list> | |
− | + | <ref local="casAuthenticationProvider"/> | |
− | + | </list> | |
− | + | </property> | |
− | + | </bean> | |
− | + | <!-- handles a logout request from the CAS server --> | |
− | + | <bean id="casSingleSignOutFilter" class="org.jasig.cas.client.session.SingleSignOutFilter"/> | |
− | + | <!-- performs CAS authentication --> | |
− | + | <bean id="casProcessingFilter" class="org.springframework.security.ui.cas.CasProcessingFilter"> | |
− | + | <property name="authenticationManager" ref="authenticationManager"/> | |
− | + | <property name="authenticationFailureUrl" value="/403.jsp"/> | |
− | + | <property name="alwaysUseDefaultTargetUrl" value="false"/> | |
− | + | <property name="defaultTargetUrl" value="/"/> | |
− | + | </bean> | |
− | + | <bean id="filterInvocationInterceptor" class="org.springframework.security.intercept.web.FilterSecurityInterceptor"> | |
− | + | <property name="authenticationManager" ref="authenticationManager"/> | |
− | + | <property name="accessDecisionManager"> | |
− | + | <bean class="org.springframework.security.vote.AffirmativeBased"> | |
− | + | <property name="allowIfAllAbstainDecisions" value="false"/> | |
− | + | <property name="decisionVoters"> | |
− | + | <list> | |
− | + | <bean class="org.springframework.security.vote.AuthenticatedVoter"/> | |
− | + | </list> | |
− | + | </property> | |
− | + | </bean> | |
− | + | </property> | |
− | + | <property name="objectDefinitionSource"> | |
− | + | <value> | |
− | + | CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON | |
− | + | PATTERN_TYPE_APACHE_ANT | |
− | + | /**=IS_AUTHENTICATED_REMEMBERED | |
− | + | </value> | |
− | + | </property> | |
− | + | </bean> | |
− | + | ||
− | + | ||
− | + | ||
</beans> | </beans> |
Última revisión de 10:50 16 oct 2014
HOW TO: Configurar la integración con CAS (JASIG Central Authentication Service)
La plataforma permite integrarse con CAS de manera transparente para autenticación de usuarios. Se deben llevar a cabo los siguientes pasos:
1. Configurar en context.properties las URLs de los servicios y las URLs del servidor CAS.
2. Agregar la configuración de CAS al archivo user-application-context.xml.
1. Configuracion de context.properties
Para habilitar el login integrado con CAS es necesario configurar los siguientes parámetros del archivo "context.properties":
- cas.thubanweb.service: la URL del servicio de Thuban® PowerDesk. Por lo general: http(s)://<server>:<port>/<Contexto>/j_spring_cas_security_check
Ejemplo: https://server:8443/PowerDesk/j_spring_cas_security_check
- cas.thubanserver.service: la URL del servicio de Thuban® Server. Por lo general: http(s)://<server>:<port>/<Contexto>/j_spring_cas_security_check
Ejemplo: https://server:8443/Server/j_spring_cas_security_check
- cas.server: la URL del servidor CAS.
Ejemplo: https://localhost:8443/cas-server-webapp-3.3.1/
- cas.server.login: la URL de login del servidor CAS.
Ejemplo: https://localhost:8443/cas-server-webapp-3.3.1/login
2. Agregar la configuración de CAS al archivo user-application-context.xml
Para agregar la configuración de CAS solo es necesario utilizar el siguiente import y ubicar el archivo cas-integration.xml en la carpeta de contexto:
<source lang="xml"><import resource="file:${thuban.context}cas-integration.xml"/></source>
El contenido del archivo CAS es el siguiente:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy"> <property name="filterInvocationDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /**=httpSessionContextIntegrationFilter,casSingleSignOutFilter,casProcessingFilter,securityContextHolderAwareRequestFilter,exceptionTranslationFilter,zkEventExceptionFilter,filterInvocationInterceptor </value> </property> </bean> <bean id="exceptionTranslationFilter" class="org.springframework.security.ui.ExceptionTranslationFilter"> <property name="authenticationEntryPoint"> <bean id="casProcessingFilterEntryPoint" class="org.springframework.security.ui.cas.CasProcessingFilterEntryPoint"> <property name="loginUrl" value="${cas.server.login}"/> <property name="serviceProperties" ref="serviceProperties"/> </bean> </property> </bean> <bean id="casAuthenticationProvider" class="org.springframework.security.providers.cas.CasAuthenticationProvider"> <property name="userDetailsService" ref="userDetailsService"/> <property name="serviceProperties" ref="serviceProperties"/> <property name="ticketValidator"> <bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator"> <constructor-arg index="0" value="${cas.server}"/> </bean> </property> <property name="key" value="my_password_for_this_auth_provider_only"/> </bean> <bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager"> <property name="providers"> <list> <ref local="casAuthenticationProvider"/> </list> </property> </bean> <bean id="casSingleSignOutFilter" class="org.jasig.cas.client.session.SingleSignOutFilter"/> <bean id="casProcessingFilter" class="org.springframework.security.ui.cas.CasProcessingFilter"> <property name="authenticationManager" ref="authenticationManager"/> <property name="authenticationFailureUrl" value="/403.jsp"/> <property name="alwaysUseDefaultTargetUrl" value="false"/> <property name="defaultTargetUrl" value="/"/> </bean> <bean id="filterInvocationInterceptor" class="org.springframework.security.intercept.web.FilterSecurityInterceptor"> <property name="authenticationManager" ref="authenticationManager"/> <property name="accessDecisionManager"> <bean class="org.springframework.security.vote.AffirmativeBased"> <property name="allowIfAllAbstainDecisions" value="false"/> <property name="decisionVoters"> <list> <bean class="org.springframework.security.vote.AuthenticatedVoter"/> </list> </property> </bean> </property> <property name="objectDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /**=IS_AUTHENTICATED_REMEMBERED </value> </property> </bean> </beans>