diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -26,7 +26,7 @@ Sputnik does **not**: ## CsrfToken example -```rs +```rust use std::convert::Infallible; use hyper::service::{service_fn, make_service_fn}; use hyper::{Method, Server}; @@ -92,7 +92,7 @@ async fn main() { After a successful authentication you can build a session id cookie for example as follows: -```rs +```rust let expiry_date = OffsetDateTime::now_utc() + Duration::hours(24); let mut cookie = Cookie::new("userid", key.sign( @@ -106,7 +106,7 @@ resp.set_cookie(cookie); This session id cookie can then be retrieved and verified as follows: -```rs +```rust let userid = req.cookies().get("userid") .ok_or_else(|| Error::unauthorized("expected userid cookie".to_owned())) .and_then(|cookie| key.verify(cookie.value()).map_err(Error::unauthorized)) |