Ueberauth CAS strategy v2.0.0 Ueberauth.Strategy.CAS.User View Source

Representation of a CAS user with their roles.

A CAS serviceResponse is either an error message or a success message. In the success case, the response often contains various attributes containing information about the user.

For example, a successful request might look like this:

<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
  <cas:authenticationSuccess>
    <cas:user>example</cas:user>
    <cas:attributes>
      <cas:authenticationDate>2016-06-29T21:53:41Z</cas:authenticationDate>
      <cas:longTermAuthenticationRequestTokenUsed>false</cas:longTermAuthenticationRequestTokenUsed>
      <cas:isFromNewLogin>true</cas:isFromNewLogin>
      <cas:email>test@example.com</cas:email>
    </cas:attributes>
  </cas:authenticationSuccess>
</cas:serviceResponse>

Note that strictly speaking version 2.0 of CAS does not support attributes. The strategy however does not make this distinction: if attributes exist, the strategy will use them.

User struct

Accessing the attributes is possible by accessing the "attributes" on the raw information. For example:

def extract_attributes(%Ueberauth.Auth{} = auth) do
  attributes = auth.extra.raw_info.user.attributes
  # Do something with the attributes
end

Link to this section Summary

Functions

Struct containing information about the user.

Link to this section Functions

Link to this function

%Ueberauth.Strategy.CAS.User{}

View Source (struct)

Struct containing information about the user.

There are two relevant fields:

  • :name - The name returned by the serviceResponse
  • :attributes - Other attributes returned by the serviceResponse