Coverage for rfpy/auth/webapp.py: 100%
20 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-24 10:52 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-24 10:52 +0000
1import logging
3from webob import Response
5from rfpy.auth.policy import PassthroughPolicy
6from rfpy.suxint import Sux
7from rfpy.web.base import WSGIApp
10log = logging.getLogger(__name__)
13auth_sux = Sux(
14 "rfpy.auth.endpoints",
15 "rfpy.auth.adaptors",
16 models_module="rfpy.auth.adaptors",
17 api_name="PostRFP Auth API",
18)
21class TokenAuthenticationApp(WSGIApp):
22 """
23 Provides /login and /logout URLs for authenticating users by username/password
24 """
26 routes = {}
28 def __init__(self, **kwargs):
29 if not kwargs.get("auth_policy", None):
30 kwargs["auth_policy"] = PassthroughPolicy()
31 super().__init__(**kwargs)
33 def validate_user(self, request):
34 pass
36 def build_sux(self):
37 self.sux_instance = auth_sux
40@TokenAuthenticationApp.route("/status")
41def status(request):
42 """
43 Check that the app is running.
45 In auth/webapp so there is no authentication so this endpoint can be called
46 from uptime monitoring tools
47 """
48 return Response(body="ok", content_type="text/plain")