+14
who-am-i/demo/index.html
+14
who-am-i/demo/index.html
+4
who-am-i/demo/serve
+4
who-am-i/demo/serve
+9
-4
who-am-i/src/server.rs
+9
-4
who-am-i/src/server.rs
···
3
use axum::{
4
Router,
5
extract::{FromRef, Query, State},
6
-
response::{Html, Redirect},
7
routing::get,
8
};
9
-
use axum_extra::extract::cookie::{Cookie, Key, SignedCookieJar};
10
11
use serde::Deserialize;
12
use std::sync::Arc;
···
55
}
56
}
57
58
-
async fn prompt(jar: SignedCookieJar) -> (SignedCookieJar, Html<String>) {
59
let m = if let Some(did) = jar.get("did") {
60
format!("oh i know you: {did}")
61
} else {
···
89
panic!("failed to do client callback");
90
};
91
let did = oauth_session.did().await.expect("a did to be present");
92
-
let jar = jar.add(Cookie::new("did", did.to_string()));
93
(jar, Html(format!("sup: {did:?}")))
94
}
···
3
use axum::{
4
Router,
5
extract::{FromRef, Query, State},
6
+
response::{Html, IntoResponse, Redirect},
7
routing::get,
8
};
9
+
use axum_extra::extract::cookie::{Cookie, Key, SameSite, SignedCookieJar};
10
11
use serde::Deserialize;
12
use std::sync::Arc;
···
55
}
56
}
57
58
+
async fn prompt(jar: SignedCookieJar) -> impl IntoResponse {
59
let m = if let Some(did) = jar.get("did") {
60
format!("oh i know you: {did}")
61
} else {
···
89
panic!("failed to do client callback");
90
};
91
let did = oauth_session.did().await.expect("a did to be present");
92
+
let cookie = Cookie::build(("did", did.to_string()))
93
+
.http_only(true)
94
+
.secure(true)
95
+
.same_site(SameSite::None)
96
+
.max_age(std::time::Duration::from_secs(86_400).try_into().unwrap());
97
+
let jar = jar.add(cookie);
98
(jar, Html(format!("sup: {did:?}")))
99
}
who-am-i/static/prompt-anon.html
who-am-i/static/prompt-anon.html
This is a binary file and will not be displayed.