Authenticate user from token in query parameter.
(connection, request)
| 121 | |
| 122 | |
| 123 | async def query_param_auth(connection, request): |
| 124 | """Authenticate user from token in query parameter.""" |
| 125 | token = get_query_param(request.path, "token") |
| 126 | if token is None: |
| 127 | return connection.respond(http.HTTPStatus.UNAUTHORIZED, "Missing token\n") |
| 128 | |
| 129 | user = get_user(token) |
| 130 | if user is None: |
| 131 | return connection.respond(http.HTTPStatus.UNAUTHORIZED, "Invalid token\n") |
| 132 | |
| 133 | connection.username = user |
| 134 | |
| 135 | |
| 136 | async def cookie_auth(connection, request): |
nothing calls this directly
no test coverage detected
searching dependent graphs…