Serve and check cookies on login route
This commit is contained in:
parent
1667c3295b
commit
c73f132421
6 changed files with 46 additions and 11 deletions
|
|
@ -1,19 +1,22 @@
|
|||
use axum::{
|
||||
extract::State,
|
||||
routing::{get, post},
|
||||
Router,
|
||||
};
|
||||
use tower_cookies::CookieManagerLayer;
|
||||
|
||||
use crate::state::RoutableAppState;
|
||||
|
||||
mod index;
|
||||
mod login;
|
||||
|
||||
pub const COOKIE_NAME: &'static str = "yunohost.ssowat";
|
||||
|
||||
/// Build a router for the application, in a specific subpath eg `/yunohost/sso/`
|
||||
pub fn router(subpath: Option<String>, state: RoutableAppState) -> Router {
|
||||
let app = Router::new()
|
||||
.route("/", get(index::route))
|
||||
.route("/login/", post(login::route))
|
||||
.layer(CookieManagerLayer::new())
|
||||
.with_state(state);
|
||||
if let Some(p) = subpath {
|
||||
Router::new()
|
||||
|
|
|
|||
Loading…
Reference in a new issue