summaryrefslogtreecommitdiff
path: root/src/errors.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-05-30 00:24:40 -0400
committerCara Salter <cara@devcara.com>2022-05-30 00:24:40 -0400
commitecca0e8cef755899049e7f541c86b9d06b2438a4 (patch)
tree1b86c9667a3044b885a468744780effee1ed401f /src/errors.rs
parentb7752eef57e008c0d2a7dad868e98ff8b802bd22 (diff)
downloadhomeworld-ecca0e8cef755899049e7f541c86b9d06b2438a4.tar.gz
homeworld-ecca0e8cef755899049e7f541c86b9d06b2438a4.zip
meta: Add Bearer authentication
Makes use of a pre-shared key. Do not expose this to the internet!
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs
index c1d6672..d4b365f 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -15,6 +15,9 @@ pub enum ServiceError {
#[error("Not Found")]
NotFound,
+
+ #[error("Not Authorized")]
+ NotAuthorized,
}
pub type StringResult<T = &'static str> = Result<T, ServiceError>;
@@ -27,6 +30,7 @@ impl IntoResponse for ServiceError {
let status = match self {
ServiceError::NotFound => StatusCode::NOT_FOUND,
+ ServiceError::NotAuthorized => StatusCode::UNAUTHORIZED,
_ => StatusCode::INTERNAL_SERVER_ERROR,
};