objectstore_server/auth/
error.rs

1use thiserror::Error;
2
3/// Error type for different authorization failure scenarios.
4#[derive(Error, Debug, PartialEq)]
5pub enum AuthError {
6    /// Indicates that something about the request prevented authorization verification from
7    /// happening properly.
8    #[error("bad request: {0}")]
9    BadRequest(&'static str),
10
11    /// Indicates that something about Objectstore prevented authorization verification from
12    /// happening properly.
13    #[error("internal error: {0}")]
14    InternalError(String),
15
16    /// Indicates that the provided authorization token is invalid (e.g. expired or malformed).
17    #[error("failed to decode token: {0}")]
18    ValidationFailure(#[from] jsonwebtoken::errors::Error),
19
20    /// Indicates that an otherwise-valid token was unable to be verified with configured keys.
21    #[error("failed to verify token")]
22    VerificationFailure,
23
24    /// Indicates that the requested operation is not authorized and auth enforcement is enabled.
25    #[error("operation not allowed")]
26    NotPermitted,
27}