Skip to main content

check

Function check 

Source
pub async fn check(
    state: &State<AppState>,
    req: &HttpRequest,
    access: &FunctionAccess,
    missing: &str,
) -> Result<Option<Principal>, HttpResponse>
Expand description

Resolve the caller and check them against access.

Ok carries the principal — None for an anonymous caller of a public endpoint. Err is the response to send, already the right status: 401 when credentials would help, 403 when they wouldn’t, and 404 for private, which is not merely forbidden but not there.