mirror of
https://codeberg.org/pfzetto/axum-oidc
synced 2025-12-08 22:25:16 +01:00
parent
fa5faed004
commit
65cb175603
4 changed files with 5 additions and 10 deletions
|
|
@ -21,3 +21,5 @@ reqwest = { version = "0.12", features = ["rustls-tls"], default-features = fals
|
||||||
env_logger = "0.11"
|
env_logger = "0.11"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
headless_chrome = "1.0"
|
headless_chrome = "1.0"
|
||||||
|
#see https://github.com/rust-headless-chrome/rust-headless-chrome/issues/535
|
||||||
|
auto_generate_cdp = "=0.4.4"
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,7 @@ use tower_sessions::{
|
||||||
Expiry, MemoryStore, SessionManagerLayer,
|
Expiry, MemoryStore, SessionManagerLayer,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub async fn run(
|
pub async fn run(issuer: String, client_id: String, client_secret: Option<String>) {
|
||||||
app_url: String,
|
|
||||||
issuer: String,
|
|
||||||
client_id: String,
|
|
||||||
client_secret: Option<String>,
|
|
||||||
) {
|
|
||||||
let session_store = MemoryStore::default();
|
let session_store = MemoryStore::default();
|
||||||
let session_layer = SessionManagerLayer::new(session_store)
|
let session_layer = SessionManagerLayer::new(session_store)
|
||||||
.with_secure(false)
|
.with_secure(false)
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,8 @@ use basic::run;
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
dotenvy::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
let app_url = std::env::var("APP_URL").expect("APP_URL env variable");
|
|
||||||
let issuer = std::env::var("ISSUER").expect("ISSUER env variable");
|
let issuer = std::env::var("ISSUER").expect("ISSUER env variable");
|
||||||
let client_id = std::env::var("CLIENT_ID").expect("CLIENT_ID env variable");
|
let client_id = std::env::var("CLIENT_ID").expect("CLIENT_ID env variable");
|
||||||
let client_secret = std::env::var("CLIENT_SECRET").ok();
|
let client_secret = std::env::var("CLIENT_SECRET").ok();
|
||||||
run(app_url, issuer, client_id, client_secret).await
|
run(issuer, client_id, client_secret).await
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@ async fn first() {
|
||||||
|
|
||||||
info!("starting basic example app");
|
info!("starting basic example app");
|
||||||
|
|
||||||
let app_url = "http://127.0.0.1:8080/";
|
let app_url = "http://localhost:8080/";
|
||||||
let app_handle = tokio::spawn(basic::run(
|
let app_handle = tokio::spawn(basic::run(
|
||||||
app_url.to_string(),
|
|
||||||
format!("{}/realms/test", keycloak.url()),
|
format!("{}/realms/test", keycloak.url()),
|
||||||
basic_client.client_id.to_string(),
|
basic_client.client_id.to_string(),
|
||||||
basic_client.client_secret.clone(),
|
basic_client.client_secret.clone(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue