Coverage for rfpy/auth/webapp.py: 100%
20 statements
« prev ^ index » next coverage.py v7.0.1, created at 2022-12-31 16:00 +0000
« prev ^ index » next coverage.py v7.0.1, created at 2022-12-31 16:00 +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', 'rfpy.auth.adaptors',
15 models_module='rfpy.auth.adaptors',
16 api_name='PostRFP Auth API'
17)
20class TokenAuthenticationApp(WSGIApp):
22 '''
23 Provides /login and /logout URLs for authenticating users by username/password
24 '''
25 routes = {}
27 def __init__(self, **kwargs):
28 if not kwargs.get('auth_policy', None):
29 kwargs['auth_policy'] = PassthroughPolicy()
30 super().__init__(**kwargs)
32 def validate_user(self, request):
33 pass
35 def build_sux(self):
36 self.sux_instance = auth_sux
39@TokenAuthenticationApp.route('/status')
40def status(request):
41 '''
42 Check that the app is running.
44 In auth/webapp so there is no authentication so this endpoint can be called
45 from uptime monitoring tools
46 '''
47 return Response(body='ok', content_type='text/plain')