Coverage for /home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/core_api/datamodels/ui/auth.py: 100%

19 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 14:22 +0000

1# Licensed to the Apache Software Foundation (ASF) under one 

2# or more contributor license agreements. See the NOTICE file 

3# distributed with this work for additional information 

4# regarding copyright ownership. The ASF licenses this file 

5# to you under the Apache License, Version 2.0 (the 

6# "License"); you may not use this file except in compliance 

7# with the License. You may obtain a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, 

12# software distributed under the License is distributed on an 

13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 

14# KIND, either express or implied. See the License for the 

15# specific language governing permissions and limitations 

16# under the License. 

17 

18from __future__ import annotations 

19 

20from enum import Enum 

21 

22from airflow.api_fastapi.common.types import ExtraMenuItem, MenuItem 

23from airflow.api_fastapi.core_api.base import BaseModel 

24 

25 

26class MenuItemCollectionResponse(BaseModel): 

27 """Menu Item Collection serializer for responses.""" 

28 

29 authorized_menu_items: list[MenuItem] 

30 extra_menu_items: list[ExtraMenuItem] 

31 

32 

33class AuthenticatedMeResponse(BaseModel): 

34 """Authenticated user information serializer for responses.""" 

35 

36 id: str 

37 username: str 

38 

39 

40class TokenType(str, Enum): 

41 """Type of token to generate.""" 

42 

43 API = "api" 

44 CLI = "cli" 

45 

46 

47class GenerateTokenBody(BaseModel): 

48 """Request body for generating a token.""" 

49 

50 token_type: TokenType = TokenType.API 

51 

52 

53class GenerateTokenResponse(BaseModel): 

54 """Response for a generated token.""" 

55 

56 access_token: str 

57 token_type: TokenType 

58 expires_in_seconds: int