404 error after CAS login

27 views
Skip to first unread message

sagar ghimire

unread,
Nov 4, 2020, 1:01:15 PM11/4/20
to CAS Community
Hello,
I am getting the 404 error, when I successfully logged in with CAS to my Spring boot webapp. Please find the attached image. Any help will be really appreciated. 



Thanks
Sagar Ghimire
Software DeveloperCapture.PNG

Gadde Sainadh

unread,
Apr 8, 2021, 1:26:48 PM4/8/21
to CAS Community, sagargh...@gmail.com
hello Sagargh, 
i created a new spring boot application and I am trying to integrate the existing CAS server for sso. I added configuration in the application. properties and I also created casconfig class file in an application and I added bean class over here. 
when I run my application got my cas login page when I enter user details able to authenticate but not able to get user details. can you help me with that? 

cas.server-url-prefix= localhost:8900/cas-web
cas.server-login-url=localhost:8900/cas-web/login
cas.client-host-url=http://localhost:8080
cas.validation-type=CAS


cas class : 

@Autowired
private CasProperties casProperties;
private static final Logger logger = LoggerFactory.getLogger(SecurityConfig.class);

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
super.configure(auth);
auth.authenticationProvider(casAuthenticationProvider());
}

@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.authorizeRequests().antMatchers("/*").permitAll().anyRequest().authenticated();
}

@Bean
public CasAuthenticationEntryPoint casAuthenticationEntryPoint() {
CasAuthenticationEntryPoint casAuthenticationEntryPoint = new CasAuthenticationEntryPoint();
casAuthenticationEntryPoint.setLoginUrl(casProperties.getCasServerLoginUrl());
casAuthenticationEntryPoint.setServiceProperties(serviceProperties());
return casAuthenticationEntryPoint;
}

@Bean
public ServiceProperties serviceProperties() {
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.setService(casProperties.getAppServerUrl() + casProperties.getAppServerLoginUrl());
serviceProperties.setSendRenew(false);
return serviceProperties;
}

@Bean
public CasAuthenticationFilter casAuthenticationFilter() throws Exception {
CasAuthenticationFilter casAuthenticationFilter = new CasAuthenticationFilter();
casAuthenticationFilter.setAuthenticationManager(authenticationManager());
casAuthenticationFilter.setFilterProcessesUrl(casProperties.getAppServerLoginUrl());
return casAuthenticationFilter;
}

@Bean
public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider casAuthenticationProvider = new CasAuthenticationProvider();
casAuthenticationProvider.setAuthenticationUserDetailsService(userDetailsByNameServiceWrapper());
casAuthenticationProvider.setServiceProperties(serviceProperties());
casAuthenticationProvider.setTicketValidator(new Cas20ServiceTicketValidator(casProperties.getCasServerUrl()));
casAuthenticationProvider.setKey("my_password_for_this_auth_provider_only");
return casAuthenticationProvider;
}

@Bean
public UserDetailsByNameServiceWrapper userDetailsByNameServiceWrapper() {
UserDetailsByNameServiceWrapper userDetailsByNameServiceWrapper = new UserDetailsByNameServiceWrapper();
userDetailsByNameServiceWrapper.setUserDetailsService(userDetailsService());
return userDetailsByNameServiceWrapper;
}


@Autowired
    public void configureGlobal(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
        authenticationManagerBuilder.userDetailsService(userDetailsService);
    }

Reply all
Reply to author
Forward
0 new messages