TokenBase

pydantic model gafaelfawr.models.token.TokenBase

Base information about a token common to several representations.

This is the information that’s common to the Redis and database representations of the token.

Parameters:

data (Any)

Show JSON schema
{
   "title": "TokenBase",
   "description": "Base information about a token common to several representations.\n\nThis is the information that's common to the Redis and database\nrepresentations of the token.",
   "type": "object",
   "properties": {
      "username": {
         "description": "User to whom the token was issued",
         "examples": [
            "someuser"
         ],
         "maxLength": 64,
         "minLength": 1,
         "title": "Username",
         "type": "string"
      },
      "token_type": {
         "$ref": "#/$defs/TokenType",
         "examples": [
            "session"
         ],
         "title": "Token type"
      },
      "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"
      },
      "scopes": {
         "$ref": "#/$defs/Scopes",
         "description": "Scopes of the token",
         "examples": [
            [
               "read:all",
               "user:token"
            ]
         ],
         "title": "Token scopes"
      },
      "created": {
         "$ref": "#/$defs/Timestamp",
         "description": "Creation timestamp of the token in seconds since epoch",
         "examples": [
            1614986130
         ],
         "title": "Creation time"
      },
      "expires": {
         "anyOf": [
            {
               "$ref": "#/$defs/Timestamp"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Expiration timestamp of the token in seconds since epoch",
         "examples": [
            1616986130
         ],
         "title": "Expiration time"
      }
   },
   "$defs": {
      "Scopes": {},
      "Timestamp": {
         "format": "date-time",
         "type": "string"
      },
      "TokenType": {
         "description": "The class of token.",
         "enum": [
            "session",
            "user",
            "notebook",
            "internal",
            "service",
            "oidc"
         ],
         "title": "TokenType",
         "type": "string"
      }
   },
   "required": [
      "username",
      "token_type",
      "scopes"
   ]
}

Fields:
field created: Timestamp [Optional]

Creation timestamp of the token in seconds since epoch

field expires: Timestamp | None = None

Expiration timestamp of the token in seconds since epoch

field scopes: Scopes [Required]

Scopes of the token

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_type: TokenType [Required]
field username: str [Required]

User to whom the token was issued

Constraints:
  • min_length = 1

  • max_length = 64