-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathping.py
More file actions
58 lines (45 loc) · 1.92 KB
/
Copy pathping.py
File metadata and controls
58 lines (45 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import satosa.micro_services.base
from satosa.logging_util import satosa_logging
from satosa.response import Response
import logging
logger = logging.getLogger(__name__)
class PingFrontend(satosa.frontends.base.FrontendModule):
"""
SATOSA frontend that responds to a query with a simple
200 OK, intended to be used as a simple heartbeat monitor.
"""
logprefix = "PING:"
def __init__(self, auth_req_callback_func, internal_attributes, config, base_url, name):
super().__init__(auth_req_callback_func, internal_attributes, base_url, name)
self.config = config
def handle_authn_response(self, context, internal_resp, extra_id_token_claims=None, **kwargs):
"""
See super class method satosa.frontends.base.FrontendModule#handle_authn_response
:type context: satosa.context.Context
:type internal_response: satosa.internal.InternalData
:rtype oic.utils.http_util.Response
"""
raise NotImplementedError()
def handle_backend_error(self, exception):
"""
See super class satosa.frontends.base.FrontendModule
:type exception: satosa.exception.SATOSAError
:rtype: oic.utils.http_util.Response
"""
raise NotImplementedError()
def register_endpoints(self, backend_names):
"""
See super class satosa.frontends.base.FrontendModule
:type backend_names: list[str]
:rtype: list[(str, ((satosa.context.Context, Any) -> satosa.response.Response, Any))]
:raise ValueError: if more than one backend is configured
"""
url_map = [("^{}".format(self.name), self.ping_endpoint)]
return url_map
def ping_endpoint(self, context, **kwargs):
"""
"""
logprefix = PingFrontend.logprefix
satosa_logging(logger, logging.DEBUG, "{} ping returning 200 OK".format(logprefix), context.state)
msg = " "
return Response(msg)