Getting the UserDetails object from a CAS assertion
Up until this point, we have been authenticating with CAS by obtaining the roles from our InMemoryUserDetailsManager
object. However, we can create the UserDetails
object from the CAS assertion just as we did with OAuth2. The first step is to configure the CAS server to return the additional attributes.
Returning LDAP attributes in the CAS response
We know that CAS can return the username in the CAS response, but it can also return arbitrary attributes in the CAS response. Let’s see how we can update the CAS server to return additional attributes. Again, all the changes in this section are in the CAS server and not in the calendar application.
Mapping LDAP attributes to CAS attributes
The first step requires us to map LDAP attributes to attributes in the CAS assertion (including the role attribute, which we’re expecting to contain the user’s GrantedAuthority
).
We’ll add another bit of configuration...