simple Log In endpoint without encryption
This commit is contained in:
37
authbruh.rs
Normal file
37
authbruh.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
use std::time::Duration;
|
||||
use axum::{
|
||||
body::{to_bytes, Body},
|
||||
http::{Request as HttpRequest, StatusCode},
|
||||
middleware::Next,
|
||||
response::{Response, IntoResponse},
|
||||
Json,
|
||||
extract::{Path, State, FromRequest}
|
||||
};
|
||||
use axum::extract::Request as ExtractRequest;
|
||||
use jsonwebtoken::{decode, DecodingKey, Validation, encode, EncodingKey, Header};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use chrono::{Utc};
|
||||
use rusqlite::{params, Connection, OptionalExtension};
|
||||
|
||||
//use crate::utils::db_pool::;
|
||||
use crate::utils::db_pool::{
|
||||
HotelPool,
|
||||
AppState,
|
||||
};
|
||||
|
||||
|
||||
pub async fn clean_auth_loging(
|
||||
State(state): State<AppState>,
|
||||
// LoginPayload(payload): LoginPayload,
|
||||
) -> impl IntoResponse {
|
||||
// You can access state.pool and state.jwt_secret here
|
||||
format!("Got secret: {}", state.jwt_secret)
|
||||
}
|
||||
|
||||
|
||||
fn internal_error<E: std::fmt::Display>(err: E) -> (StatusCode, String) {
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, format!("Internal error: {}", err))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user