TokenUserInfo#

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

Bases: BaseModel

User metadata stored with the token.

Holds the user metadata generated by the authentication provider or the admin token request and stored with the token, without any supplemental information from LDAP or Firestore. Fields that are set will override any data from extenral sources. Fields set to None will be looked up in LDAP or Firestore.

Parameters:

data (Any)

Attributes Summary

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Summary

to_userinfo_dict()

Convert to a dictionary for logging purposes.

Attributes Documentation

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

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 model_dump(mode="json", 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