user_dependency¶
- async controller.dependencies.user.user_dependency(context, x_auth_request_user, x_auth_request_token)¶
Return the validated user for the given request.
Some user routes will have both a user token and a user name specified in the headers. We want to make sure that the user name matches the name of the user that owns the token.
- Returns:
Validated user metadata from Gafaelfawr.
- Return type:
- Raises:
controller.exceptions.GafaelfawrParseError – Raised if the Gafaelfawr response could not be parsed.
controller.exceptions.GafaelfawrWebError – Raised if the token could not be validated with Gafaelfawr.
controller.exceptions.InvalidTokenError – Raised if the token was rejected by Gafaelfawr.
PermissionDeniedError – Raised if the user’s token does not match the username in the header.
- Parameters:
context (
RequestContext
)x_auth_request_user (
str
)x_auth_request_token (
str
)