GitHubTokenExchangeResult#

class gafaelfawr.models.github_actions.GitHubTokenExchangeResult(*, token, username, github_project_id, scopes, expires, claims)#

Bases: BaseModel

Outcome of a successful GitHub Actions token exchange.

This is what the exchange service returns to the route handler, which builds the reply to the client from it and records the exchange in the metrics events. It carries the identity the exchange resolved and the claims it resolved it from, so that an exchange can be traced to the exact workflow run that performed it.

Parameters:

Attributes Summary

model_config

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

Methods Summary

to_event()

Build the metrics event recording the exchange.

to_reply()

Build the reply to send to the client.

Attributes Documentation

model_config: ClassVar[ConfigDict] = {}#

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

Methods Documentation

to_event()#

Build the metrics event recording the exchange.

The event ties the minted token to the workflow run that obtained it, using the claims in AUDIT_CLAIMS.

Returns:

Metrics event for the exchange.

Return type:

GitHubTokenExchangeEvent

to_reply()#

Build the reply to send to the client.

Returns:

Reply following RFC 6749 and RFC 8693, with the remaining lifetime of the token calculated as of now.

Return type:

GitHubTokenExchangeReply