only set path to relative
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details

pull/8/head super_test
Patrick Cleavelin 2023-08-01 11:55:18 -05:00
parent 17ec2185d0
commit 9a832a5aac
1 changed files with 4 additions and 2 deletions

View File

@ -9,7 +9,7 @@ use axum::{
}; };
use axum_extra::extract::{cookie::Cookie, CookieJar}; use axum_extra::extract::{cookie::Cookie, CookieJar};
use reqwest::{Proxy, StatusCode}; use reqwest::{Proxy, StatusCode, Url};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{json, Value}; use serde_json::{json, Value};
use tracing::{error, info}; use tracing::{error, info};
@ -221,8 +221,10 @@ pub(crate) async fn v2_auth(
); );
// TODO: add permissions based on roles // TODO: add permissions based on roles
let uri = Url::parse(&state.origin).expect("should be a valid url");
let mut cookie = Cookie::new("access_token", token.clone()); let mut cookie = Cookie::new("access_token", token.clone());
cookie.set_path(format!("{}/", state.origin)); cookie.set_path(uri.path().to_string());
cookie.set_secure(true); cookie.set_secure(true);
Ok((jar.add(cookie), Redirect::to(&format!("{}/", state.origin)))) Ok((jar.add(cookie), Redirect::to(&format!("{}/", state.origin))))