I have a spring boot application, which is MVC in nature. All page of this application are being authenticated by CAS SSO. I have used "spring-security-cas" as described at https://www.baeldung.com/spring-security-cas-sso Everything working fine as expected. However, I have one problem - that is, I cannot retrieve attributes and username sent by the CAS server in the following @Bean. What need I do to retrieve all the attributes and and username sent by the CAS server?
@Bean
public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider provider = new CasAuthenticationProvider();
provider.setServiceProperties(serviceProperties());
provider.setTicketValidator(ticketValidator());
provider.setUserDetailsService(
s -> new User("casuser", "Mellon", true, true, true, true,
AuthorityUtils.createAuthorityList("ROLE_ADMIN")));
provider.setKey("CAS_PROVIDER_LOCALHOST_9000");
return provider;
}
SecurityContextHolder.getContext().getAuthentication().getPrincipal()
. Please check the example below section that starts with The /secured path is mapped to the index() in the document shared – R.G