PRayno / CasAuthBundle

Basic CAS (SSO) authenticator for Symfony (version 3,4 and 5)
MIT License
16 stars 19 forks source link

Add user attributes from CAS response #5

Open adamfranco opened 8 years ago

adamfranco commented 8 years ago

While CAS Protocol 1.0 & 2.0 defined only a <cas:user> attribute as required in the authentication response, many CAS server implementations release additional attributes. This attribute release can inform the application of details like a user's name, email address, preferred locale, and group membership. The phpCAS library currently supports looking for additional attributes in the CAS response encoded in several common formats. Replicating this support in CasAuthBundle will open-up a number of options to applications using this bundle.

My read on the structure of the Symfony Authenticator/UserProvider/User system is that the proper place for attribute parsing and structuring would be in the CasUserProvider. The CasUserProvider would need access to the serviceValidate response XML though, so that would need to be provided to it by the CasAuthenticator prior to $userProvider->loadUserByUsername() being called. I'll have to investigate further how to properly expose a mechanism for passing data from the CasAuthenticator to the CasUserProvider that won't cause problems if there are multiple Authenticators or UserProviders configured into the application.

adamfranco commented 8 years ago

More details on the new CAS-protocol 3.0 attribute format: https://apereo.github.io/cas/4.2.x/protocol/CAS-Protocol-Specification.html#attributes-cas-30