Use MemoryStore for sessions to be able to clear sessions
This commit is contained in:
parent
9af4831efa
commit
68f50b5292
@ -2,7 +2,7 @@ use std::{net::SocketAddr, path::{Path, PathBuf}, ffi::{OsStr, OsString}, fs::Fi
|
||||
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use axum::{Router, routing::{get, post}, response::{IntoResponse, Redirect}, http::{StatusCode, header}, extract::{self, State}, Form, handler::Handler};
|
||||
use axum_sessions::{async_session::CookieStore, SessionLayer, extractors::{ReadableSession, WritableSession}};
|
||||
use axum_sessions::{async_session::MemoryStore, SessionLayer, extractors::{ReadableSession, WritableSession}};
|
||||
use axum_template::{RenderHtml, engine::Engine};
|
||||
use chacha20poly1305::{XChaCha20Poly1305, KeyInit, AeadCore, aead::{OsRng, rand_core::RngCore, Aead}, XNonce};
|
||||
use chrono::{DateTime, Utc};
|
||||
@ -58,6 +58,7 @@ async fn main() {
|
||||
.with(tracing_formatter)
|
||||
.init();
|
||||
|
||||
let sessions = MemoryStore::new();
|
||||
let image_dir = PathBuf::from(image_path);
|
||||
let image_cache = ImageCache::default();
|
||||
let image_list_cache = ImageListCache::default();
|
||||
@ -72,7 +73,7 @@ async fn main() {
|
||||
jinja.add_template("index", include_str!("../templates/index.html")).unwrap();
|
||||
jinja.add_template("login", include_str!("../templates/login.html")).unwrap();
|
||||
|
||||
let session_layer = SessionLayer::new(CookieStore::new(), &secret_key)
|
||||
let session_layer = SessionLayer::new(sessions, &secret_key)
|
||||
.with_cookie_name("session")
|
||||
.with_session_ttl(None);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user