Add basic auth support to get Cardlife working in non-offline mode

This commit is contained in:
NGnius (Graham) committed 2025-01-25 17:44:26 -05:00
commit fe2816e9d3
13 files changed
+3714

No files matched your search

@@ -0,0 +1,17 @@
//! Not a temporary file, this is the name of the endpoint
use rocket::{post, routes, serde::json::Json};
#[post("/api/auth/temporarygetuserid", data = "<body>")]
pub fn temp_migration(body: Json<libfj::cardlife::TempGetUserIdPayload>) -> Json<libfj::cardlife::TempGetUserIdResponse> {
Json(libfj::cardlife::TempGetUserIdResponse {
public_id: body.public_id.to_owned(),
token: body.token.to_owned(),
user_id: 123456, // FIXME
})
}
pub fn stage() -> rocket::fairing::AdHoc {
rocket::fairing::AdHoc::on_ignite("CardLife Temp UserId", |rocket| async {
rocket.mount("/", routes![temp_migration])
})
}