APILoginResponse

pydantic model gafaelfawr.models.auth.APILoginResponse

Response to an API login request.

The JavaScript UI visits the /auth/api/v1/login route to get a CSRF token and metadata about the currently-authenticated user from the session cookie (which the UI doesn’t have the keys to read).

Parameters:

data (Any)

Show JSON schema
{
   "title": "APILoginResponse",
   "description": "Response to an API login request.\n\nThe JavaScript UI visits the ``/auth/api/v1/login`` route to get a CSRF\ntoken and metadata about the currently-authenticated user from the session\ncookie (which the UI doesn't have the keys to read).",
   "type": "object",
   "properties": {
      "csrf": {
         "description": "This token must be included in any non-GET request using cookie authentication as the value of the ``X-CSRF-Token`` header",
         "examples": [
            "OmNdVTtKKuK_VuJsGFdrqg"
         ],
         "title": "CSRF token",
         "type": "string"
      },
      "username": {
         "description": "Authenticated identity from the cookie",
         "examples": [
            "someuser"
         ],
         "title": "Username",
         "type": "string"
      },
      "scopes": {
         "description": "Access scopes for this authenticated user",
         "examples": [
            "read:all",
            "user:token"
         ],
         "items": {
            "type": "string"
         },
         "title": "Access scopes",
         "type": "array"
      },
      "config": {
         "$ref": "#/$defs/APIConfig",
         "description": "Additional configuration information",
         "title": "Server configuration"
      }
   },
   "$defs": {
      "APIConfig": {
         "description": "Configuration information for the API.\n\nSupplemental information about the Gafaelfawr configuration that is useful\nto a UI and therefore is returned as part of a login response.",
         "properties": {
            "scopes": {
               "description": "All scopes currently recognized by the server.  Tokens may have other scopes, but new tokens may only be issued with one of these scopes.",
               "items": {
                  "$ref": "#/$defs/Scope"
               },
               "title": "All known scopes",
               "type": "array"
            }
         },
         "required": [
            "scopes"
         ],
         "title": "APIConfig",
         "type": "object"
      },
      "Scope": {
         "description": "A known token scope.",
         "properties": {
            "name": {
               "examples": [
                  "user:token"
               ],
               "title": "Scope name",
               "type": "string"
            },
            "description": {
               "examples": [
                  "Can create and modify user tokens"
               ],
               "title": "Scope description",
               "type": "string"
            }
         },
         "required": [
            "name",
            "description"
         ],
         "title": "Scope",
         "type": "object"
      }
   },
   "required": [
      "csrf",
      "username",
      "scopes",
      "config"
   ]
}

Fields:
field config: APIConfig [Required]

Additional configuration information

field csrf: str [Required]

This token must be included in any non-GET request using cookie authentication as the value of the X-CSRF-Token header

field scopes: list[str] [Required]

Access scopes for this authenticated user

field username: str [Required]

Authenticated identity from the cookie