TokenUserInfo#

class gafaelfawr.models.token.TokenUserInfo(**data)#

Bases: BaseModel

The information about a user stored with their token.

If information is stored with the token, it overrides information from other sources such as LDAP. Fields that should be dynamically retrieved from LDAP should be omitted or set to None.

Parameters:

data (Any) –

Methods Summary

to_userinfo_dict()

Convert to a dictionary for logging purposes.

Methods Documentation

to_userinfo_dict()#

Convert to a dictionary for logging purposes.

This method converts only the TokenUserInfo portion of a token to a dictionary for logging purposes, excluding the username field (which is logged separately). It’s used when logging creation of new tokens to make a record of the user identity information included in the token (as opposed to retrieved dynamically from other sources such as LDAP or Firestore).

Returns:

Dictionary of information, roughly equivalent to calling dict(exclude_none=True) on the TokenUserInfo object, but ensuring that only its data is included even if called on a subclass such as TokenData.

Return type:

dict