TokenInfo

pydantic model gafaelfawr.models.token.TokenInfo

Information about a token returned by the token-info endpoint.

This is all the information about the token that’s stored in the underlying database. It includes some fields not present in Redis.

Parameters:

data (Any)

Show JSON schema
{
   "title": "TokenInfo",
   "description": "Information about a token returned by the token-info endpoint.\n\nThis is all the information about the token that's stored in the\nunderlying database.  It includes some fields not present in Redis.",
   "type": "object",
   "properties": {
      "username": {
         "description": "User to whom the token was issued",
         "examples": [
            "someuser"
         ],
         "maxLength": 64,
         "minLength": 1,
         "title": "Username",
         "type": "string"
      },
      "token_type": {
         "allOf": [
            {
               "$ref": "#/$defs/TokenType"
            }
         ],
         "examples": [
            "session"
         ],
         "title": "Token type"
      },
      "scopes": {
         "description": "Scopes of the token",
         "examples": [
            [
               "read:all",
               "user:token"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "Token scopes",
         "type": "array"
      },
      "created": {
         "description": "Creation timestamp of the token in seconds since epoch",
         "examples": [
            1614986130
         ],
         "format": "date-time",
         "title": "Creation time",
         "type": "string"
      },
      "expires": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Expiration timestamp of the token in seconds since epoch",
         "examples": [
            1616986130
         ],
         "title": "Expiration time"
      },
      "token": {
         "examples": [
            "5KVApqcVbSQWtO3VIRgOhQ"
         ],
         "maxLength": 22,
         "minLength": 22,
         "title": "Token key",
         "type": "string"
      },
      "token_name": {
         "anyOf": [
            {
               "maxLength": 64,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "examples": [
            "laptop token"
         ],
         "title": "User-given name of the token"
      },
      "service": {
         "anyOf": [
            {
               "maxLength": 64,
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Service to which the token was delegated.  Only present for internal tokens",
         "examples": [
            "some-service"
         ],
         "title": "Service"
      },
      "last_used": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "When the token was last used in seconds since epoch",
         "examples": [
            1614986130
         ],
         "title": "Last used"
      },
      "parent": {
         "anyOf": [
            {
               "maxLength": 22,
               "minLength": 22,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "examples": [
            "DGO1OnPohl0r3C7wqhzRgQ"
         ],
         "title": "Parent token"
      }
   },
   "$defs": {
      "TokenType": {
         "description": "The class of token.",
         "enum": [
            "session",
            "user",
            "notebook",
            "internal",
            "service",
            "oidc"
         ],
         "title": "TokenType",
         "type": "string"
      }
   },
   "required": [
      "username",
      "token_type",
      "scopes",
      "token"
   ]
}

Fields:
Validators:
field created: datetime [Optional]

Creation timestamp of the token in seconds since epoch

Validated by:
field expires: datetime | None = None

Expiration timestamp of the token in seconds since epoch

Validated by:
field last_used: datetime | None = None

When the token was last used in seconds since epoch

Validated by:
field parent: str | None = None
Constraints:
  • min_length = 22

  • max_length = 22

field scopes: list[str] [Required]

Scopes of the token

Validated by:
field service: str | None = None

Service to which the token was delegated. Only present for internal tokens

Constraints:
  • min_length = 1

  • max_length = 64

field token: str [Required]
Constraints:
  • min_length = 22

  • max_length = 22

field token_name: str | None = None
Constraints:
  • min_length = 1

  • max_length = 64

field token_type: TokenType [Required]
field username: str [Required]

User to whom the token was issued

Constraints:
  • min_length = 1

  • max_length = 64