Coverage for /builds/BuildGrid/buildgrid/buildgrid/server/auth/enums.py: 100.00%

19 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-06-11 15:37 +0000

1# Copyright (C) 2023 Bloomberg LP 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# <http://www.apache.org/licenses/LICENSE-2.0> 

8# 

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

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15from enum import Enum 

16 

17 

18class AuthMetadataMethod(Enum): 

19 # No authorization: 

20 NONE = "none" 

21 # Authorize based on client identity headers: 

22 HEADERS = "headers" 

23 # JWT based authorization: 

24 JWT = "jwt" 

25 

26 

27class AuthMetadataAlgorithm(Enum): 

28 # No encryption involved: 

29 UNSPECIFIED = "unspecified" 

30 # JWT related algorithms: 

31 JWT_ES256 = "es256" # ECDSA signature algorithm using SHA-256 hash algorithm 

32 JWT_ES384 = "es384" # ECDSA signature algorithm using SHA-384 hash algorithm 

33 JWT_ES512 = "es512" # ECDSA signature algorithm using SHA-512 hash algorithm 

34 JWT_HS256 = "hs256" # HMAC using SHA-256 hash algorithm 

35 JWT_HS384 = "hs384" # HMAC using SHA-384 hash algorithm 

36 JWT_HS512 = "hs512" # HMAC using SHA-512 hash algorithm 

37 JWT_PS256 = "ps256" # RSASSA-PSS using SHA-256 and MGF1 padding with SHA-256 

38 JWT_PS384 = "ps384" # RSASSA-PSS signature using SHA-384 and MGF1 padding with SHA-384 

39 JWT_PS512 = "ps512" # RSASSA-PSS signature using SHA-512 and MGF1 padding with SHA-512 

40 JWT_RS256 = "rs256" # RSASSA-PKCS1-v1_5 signature algorithm using SHA-256 hash algorithm 

41 JWT_RS384 = "rs384" # RSASSA-PKCS1-v1_5 signature algorithm using SHA-384 hash algorithm 

42 JWT_RS512 = "rs512" # RSASSA-PKCS1-v1_5 signature algorithm using SHA-512 hash algorithm