spring-securityspring-bootcasjasigspring-security-cas

jasig cas too many redirects issue


I'm trying to secure a spring-boot web application using spring security and spring-security-cas (SSO with Jasig CAS).

I'm facing a too many redirects error when trying to access a protected resources. The project is available here

Do you see any error in my configuration?

Thanks in advance

redirect loop error screenshot


Solution

  • Finally found out the error:

    In SpringSecurity 4.x, CasAuthenticationFilter's defaultFilterProcessesUrl path is changed. So Change '/j_spring_cas_security_check' to '/login/cas' in Configuration.

    So in my application.properties file, i had to change

    app.service.security=http://localhost:7777/j_spring_cas_security_check
    

    to

    app.service.security=http://localhost:7777/login/cas
    

    So the ServiceProperties Bean would become

       @Bean
        public ServiceProperties serviceProperties() {
            ServiceProperties serviceProperties = new ServiceProperties();
            serviceProperties.setService("http://localhost:7777/login/cas");
            serviceProperties.setSendRenew(false);
            return serviceProperties;
        }
    

    Hope it'll help someone else!