MCPcopy
hub / github.com/bugy/script-server / find_basic_auth_username

Function find_basic_auth_username

src/utils/audit_utils.py:75–85  ·  view source on GitHub ↗
(request_handler)

Source from the content-addressed store, hash-verified

73
74
75def find_basic_auth_username(request_handler):
76 auth_header = request_handler.request.headers.get('Authorization')
77 if (auth_header is None) or (not auth_header.lower().startswith('basic ')):
78 return None
79
80 encoding = sys.getdefaultencoding()
81 credential_bytes = base64.b64decode(auth_header[6:])
82 credentials = credential_bytes.decode(encoding)
83 username = credentials.split(':')[0]
84
85 return username
86
87
88def get_audit_username(all_audit_names):

Callers 1

get_all_audit_namesFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected