Unable to access User attributes via SAML from Spring Boot App

Hello there,

Our company uses Radiant Logic federated ID service, we’ve imported some users into our OKTA account and I can verify that the LDAP attributes have been imported successfully as well.

I’ve followed the blog examples and implemented both an OAuth2 as well as a SAML SSO for a couple of Spring Boot applications, however, I’m unable to access the LDAP attributes from either one. For the SAML app in my controller, I’m trying to access the attributes from the org.springframework.security.core.Authentication passed in to a GetMapping method as below:

@GetMapping("/policies")

public String ltListFiltered(Model model, HttpSession session, Authentication auth) {

ArrayList<Policy> polsList = new ArrayList<Policy>();

Iterable<Subscriber> subscribers = subscriberRepo.findAll();

String currentUsername = ((SAMLCredential) auth.getCredentials()).getNameID().getValue();

log.debug(((SAMLCredential) auth.getCredentials()).getAttributes().size()); >>> This is returning zero!

As you can see from the above code snippet, I’m getting an empty list for attributes, am I supposed to add a configuration to my web security config to be able to access these or am I missing something?

Thanks in advance for your help.