MCPcopy
hub / github.com/pallets/werkzeug / auth_required

Method auth_required

examples/httpbasicauth.py:17–23  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

15 return username in self.users and self.users[username] == password
16
17 def auth_required(self, request):
18 return Response(
19 "Could not verify your access level for that URL.\n"
20 "You have to login with proper credentials",
21 401,
22 {"WWW-Authenticate": f'Basic realm="{self.realm}"'},
23 )
24
25 def dispatch_request(self, request):
26 return Response(f"Logged in as {request.authorization.username}")

Callers 1

__call__Method · 0.95

Calls 1

ResponseClass · 0.90

Tested by

no test coverage detected