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": {
         "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"
      }
   },
   "$defs": {
      "TokenType": {
         "description": "The class of token.",
         "enum": [
            "session",
            "user",
            "notebook",
            "internal",
            "service",
            "oidc"
         ],
         "title": "TokenType",
         "type": "string"
      }
   },
   "required": [
      "username",
      "token_type",
      "scopes"
   ]
}

Fields:
Validators:
field created: Timestamp [Optional]

Creation timestamp of the token in seconds since epoch

Constraints:
  • func = <function <lambda> at 0x7fe681f01260>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘int’>

  • when_used = always

field expires: Timestamp | None = None

Expiration timestamp of the token in seconds since epoch

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

User to whom the token was issued

Constraints:
  • min_length = 1

  • max_length = 64