tsk-51: Refresh token endpoint #54
@@ -165,7 +165,15 @@ pub mod endpoint {
|
||||
// * Check token type
|
||||
// - For right now, just worry about service tokens
|
||||
// * Create a new token with a longer expiration
|
||||
let token_type = token_stuff::get_token_type(&key, &payload.access_token).unwrap();
|
||||
|
||||
if token_stuff::is_token_type_valid(&token_type) {
|
||||
// let (token_literal, dur) = token_stuff::create_service_refresh_token(&key, )
|
||||
(axum::http::StatusCode::OK, axum::Json(response))
|
||||
} else {
|
||||
response.message = String::from("Invalid token type");
|
||||
(axum::http::StatusCode::NOT_FOUND, axum::Json(response))
|
||||
}
|
||||
} else {
|
||||
response.message = String::from("Could not verify token");
|
||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||
|
@@ -223,4 +223,7 @@ pub mod service {
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Write a function to get a passphrase record with an id
|
||||
// pub async fn get_passphrase(pool: &)
|
||||
}
|
||||
|
@@ -69,6 +69,14 @@ pub fn extract_id_from_token(key: &String, token: &String) -> Result<uuid::Uuid,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_token_type(key: &String, token: &String) -> Result<String, std::io::Error> {
|
||||
Ok(String::new())
|
||||
}
|
||||
|
||||
pub fn is_token_type_valid(token_type: &String) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn get_payload(
|
||||
key: &String,
|
||||
token: &String,
|
||||
|
Reference in New Issue
Block a user