Type Definition gotham_restful::AuthSuccess
source · [−]Expand description
This return type can be used to wrap any type implementing IntoResponse that can only be returned if the client is authenticated. Otherwise, an empty 403 Forbidden response will be issued.
Use can look something like this (assuming the auth
feature is enabled):
#[read_all]
fn read_all(auth : AuthStatus<MyAuthData>) -> AuthSuccess<NoContent> {
let auth_data = match auth {
AuthStatus::Authenticated(data) => data,
_ => return Err(Forbidden)
};
// do something
Ok(NoContent::default())
}