Good day everybody.
I am facing a problem on Apereo CAS 5.0.1, and after trying for an entire
day to look for a solution by myself I decided to ask some help from the
community.
Oh, I am completely new to CAS, having started experimenting with this
technology no more than 7 days ago, so I hope to be able to describe the
problem scenario using the correct terminology...
I am currently trying to setup a lab-environment to provide SSO for a
Spring Boot web application (as CAS Client), authenticating through CAS3
protocol on the Apereo CAS v.5.0.1
I have correctly configured the CAS Server to use an Apache Directory
Server (v. 2.0.4) as authentication back-end for users.
After some research on internet and several attempts I was able to
configure my security configuration class interfacing to the CAS (you can
see down here a small excerpt):
@Configuration
@EnableWebSecurity
public class SecurityAccessConfiguration extends
WebSecurityConfigurerAdapter {
private static final String[] PUBLIC_URLS = {
"/",
"/css/**",
"/fonts/**",
"/js/**",
"/images/**" };
private static final String[] ADMIN_ONLY_URLS = {};
private static final String[] AUTHENTICATED_ONLY_URLS = {};
@Bean
public ServiceProperties serviceProperties() {
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.setService("https://localhost:9998/");
serviceProperties.setSendRenew(false);
return serviceProperties;
}
@Bean
public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider casAuthenticationProvider = new
CasAuthenticationProvider();
casAuthenticationProvider.setAuthenticationUserDetailsService(authenticationUserDetailsService());
casAuthenticationProvider.setServiceProperties(serviceProperties());
casAuthenticationProvider.setTicketValidator(cas30ServiceTicketValidator());
casAuthenticationProvider.setKey("tako_client");
return casAuthenticationProvider;
}
@Bean
public AuthenticationUserDetailsService authenticationUserDetailsService() {
return new UserDetailsServiceImpl();
}
@Bean
public Cas30ServiceTicketValidator cas30ServiceTicketValidator() {
return new
Cas30ServiceTicketValidator("https://localhost:8443/cas/p3/serviceValidate");
}
@Bean
public CasAuthenticationFilter casAuthenticationFilter() throws Exception {
CasAuthenticationFilter casAuthenticationFilter = new
CasAuthenticationFilter();
casAuthenticationFilter.setAuthenticationManager(authenticationManager());
return casAuthenticationFilter;
}
@Bean
public CasAuthenticationEntryPoint casAuthenticationEntryPoint() {
CasAuthenticationEntryPoint casAuthenticationEntryPoint = new
CasAuthenticationEntryPoint();
casAuthenticationEntryPoint.setLoginUrl("https://localhost:8443/cas/login");
casAuthenticationEntryPoint.setServiceProperties(serviceProperties());
return casAuthenticationEntryPoint;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.addFilter(casAuthenticationFilter()).exceptionHandling().authenticationEntryPoint(casAuthenticationEntryPoint())
.and().csrf().disable().cors().disable()
.authorizeRequests().antMatchers(PUBLIC_URLS).anonymous()
.and()
.authorizeRequests().anyRequest().authenticated();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws
Exception {
auth.authenticationProvider(casAuthenticationProvider());
}
}
Now, everything seems to be working fine: I visit the homepage of my app,
and when I click any other link on the page I am redirected to the login
page of the CAS;
from there I login with the username and password of the user stored on the
Apache Directory Server and I am redirected on my web application homepage.
Below you can see that the CAS is passing me back the TGT as part of the
URL:
<https://lh3.googleusercontent.com/-XQbd1qSiRuQ/WUju3QUy-8I/AAAAAAAAQNY/tzaVyDQlYcYJoM033-oYcYaIbfaFto5zACLcBGAs/s1600/Screenshot%2Bfrom%2B2017-06-20%2B18-44-13.png>
...But that's it unfortunately. Every time I try to click on any other link
on the home page, I am just redirected to the homepage again, and the
homepage URL shows each time a different ticket number each time I try to
click a new link.
I attach another screenshot down here another screenshot with the network
calls trace from Chrome developer tools:
<https://lh3.googleusercontent.com/-0q2UBBhhMcQ/WUj0CpNf3sI/AAAAAAAAQNw/TKYgXWebJMUMf-ZWrlec-7kgjUhsMfRZwCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-06-20%2B19-07-51.png>
Can anybody explain me where I am getting it wrong? Is it some wrong
parameter in my Spring Boot configuration? Or maybe I should modify
something in the configuration of the CAS server itself?
I thank you in advance for your support.
J.B.
--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
You received this message because you are subscribed to the Google Groups "CAS
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/a/apereo.org/d/msgid/cas-user/6c2caada-42bd-43b0-83c2-89db59862f7b%40apereo.org.