authnzerver.handlers module

These are handlers for the authnzerver.

class authnzerver.handlers.AuthHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: tornado.web.RequestHandler

This handles the actual auth requests.

initialize(config, executor, reqid_cache, failed_passchecks)[source]

This sets up stuff.

post()[source]

Handles the incoming POST request.

class authnzerver.handlers.EchoHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: tornado.web.RequestHandler

This just echoes back whatever we send.

Useful to see if the encryption is working as intended.

initialize(authdb, fernet_secret, executor)[source]

This sets up stuff.

post()[source]

Handles the incoming POST request.

class authnzerver.handlers.FrontendEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.encoder.JSONEncoder

default(obj)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
authnzerver.handlers.auth_echo(payload)[source]

This just echoes back the payload.

authnzerver.handlers.check_host(remote_ip)[source]

This just returns False if the remote_ip != 127.0.0.1

authnzerver.handlers.decrypt_request(requestbody_base64, fernet_key)[source]

This decrypts the incoming request.

authnzerver.handlers.encrypt_response(response_dict, fernet_key)[source]

This encrypts the outgoing response.