Coverage for mlos_bench/mlos_bench/services/types/authenticator_type.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-06 00:35 +0000

1# 

2# Copyright (c) Microsoft Corporation. 

3# Licensed under the MIT License. 

4# 

5""" 

6Protocol interface for authentication for the cloud services. 

7""" 

8 

9from typing import Protocol, runtime_checkable 

10 

11 

12@runtime_checkable 

13class SupportsAuth(Protocol): 

14 """ 

15 Protocol interface for authentication for the cloud services. 

16 """ 

17 

18 def get_access_token(self) -> str: 

19 """ 

20 Get the access token for cloud services. 

21 

22 Returns 

23 ------- 

24 access_token : str 

25 Access token. 

26 """ 

27 

28 def get_auth_headers(self) -> dict: 

29 """ 

30 Get the authorization part of HTTP headers for REST API calls. 

31 

32 Returns 

33 ------- 

34 access_header : dict 

35 HTTP header containing the access token. 

36 """