Skip to content

Commit

Permalink
feat: add /auth/verify-session endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKeks committed Oct 14, 2024
1 parent cf35c27 commit 52c9d4a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/services/auth/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl From<AuthService> for Router

let cors = Router::new()
.route("/logout", routing::get(logout))
.route("/verify-session", routing::get(verify_session))
.route_layer(middleware::cors::dashboard([http::Method::OPTIONS, http::Method::GET]))
.with_state(svc);

Expand Down Expand Up @@ -95,6 +96,19 @@ async fn logout(
Ok(LogoutResponse { cookies })
}

/// Verify whether a session token is still valid.
///
/// This endpoint will return a status in the 4xx range if you do not have a
/// valid session token, and a `200 OK` if you do.
#[tracing::instrument]
#[utoipa::path(get, path = "/auth/verify-session", tag = "Auth")]
async fn verify_session(session: Session)
{
// We don't actually need to do anything here; the middleware will reject
// any unauthorized requests, and `()` turns into an empty `200 OK`
// response.
}

/// Hit by Steam after a successful login.
#[tracing::instrument(skip(cookies), err(Debug, level = "debug"))]
async fn callback(
Expand Down

0 comments on commit 52c9d4a

Please sign in to comment.