diff --git a/endpoint/Cargo.lock b/endpoint/Cargo.lock index a5de785..62b7b71 100644 --- a/endpoint/Cargo.lock +++ b/endpoint/Cargo.lock @@ -85,7 +85,7 @@ checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -96,7 +96,7 @@ checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -316,7 +316,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 1.0.85", + "syn", ] [[package]] @@ -327,7 +327,7 @@ checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" dependencies = [ "darling_core", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -371,7 +371,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -501,7 +501,7 @@ checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -757,21 +757,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" -[[package]] -name = "jsonwebkey" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c57c852b14147e2bd58c14fde40398864453403ef632b1101db130282ee6e2cc" -dependencies = [ - "base64 0.13.0", - "bitflags", - "generic-array", - "serde", - "serde_json", - "thiserror", - "zeroize", -] - [[package]] name = "jsonwebtoken" version = "9.1.0" @@ -1051,7 +1036,6 @@ dependencies = [ "base64 0.13.0", "chrono", "either", - "jsonwebkey", "jsonwebtoken", "lambda-web", "lazy_static", @@ -1087,7 +1071,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -1183,7 +1167,7 @@ checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", "version_check", "yansi", ] @@ -1253,7 +1237,7 @@ checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -1354,7 +1338,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 1.0.85", + "syn", "unicode-xid", ] @@ -1411,7 +1395,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 1.0.85", + "syn", ] [[package]] @@ -1491,7 +1475,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 1.0.85", + "syn", ] [[package]] @@ -1523,7 +1507,7 @@ checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -1534,7 +1518,7 @@ checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -1684,17 +1668,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "syn" -version = "2.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "tempfile" version = "3.3.0" @@ -1726,7 +1699,7 @@ checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -1817,7 +1790,7 @@ checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -1894,7 +1867,7 @@ checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.85", + "syn", ] [[package]] @@ -2254,17 +2227,3 @@ name = "zeroize" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12a3946ecfc929b583800f4629b6c25b88ac6e92a40ea5670f77112a85d40a8b" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] diff --git a/endpoint/Cargo.toml b/endpoint/Cargo.toml index 2369ddb..5181abb 100644 --- a/endpoint/Cargo.toml +++ b/endpoint/Cargo.toml @@ -25,8 +25,6 @@ base64 = "0.13" url = { version = "2.4.1", features = ["serde"] } rsa = { version = "0.9.2", features = ["pem", "sha2"] } rand = "0.8.5" -jsonwebkey = "0.3.5" - [dependencies.lambda-web] version = "0.1.8" diff --git a/endpoint/src/auth.rs b/endpoint/src/auth.rs index 786b7b7..b4326ab 100644 --- a/endpoint/src/auth.rs +++ b/endpoint/src/auth.rs @@ -131,10 +131,6 @@ impl<'r> FromRequest<'r> for UserToken { req: &'r Request<'_>, ) -> request::Outcome> { if let Some(authen_header) = req.headers().get_one("Authorization") { - println!( - "request state: {:?}", - req.rocket().state::().unwrap() - ); let authen_str = authen_header.to_string(); if authen_str.starts_with("Bearer") { let token = authen_str[6..authen_str.len()].trim(); @@ -157,8 +153,6 @@ impl<'r> FromRequest<'r> for UserToken { } } -// const MY_NOT_SO_SECRET_KEY: &[u8; 8] = b"abcdefgh"; - pub fn generate_keys() -> KeyPair { let mut rng = rand::thread_rng(); diff --git a/endpoint/src/main.rs b/endpoint/src/main.rs index 5fee9cd..d07c5ed 100644 --- a/endpoint/src/main.rs +++ b/endpoint/src/main.rs @@ -77,6 +77,7 @@ fn openid_configuration() -> Json { Json(openid_conf) } +/// endpoint to retrieve the Json Web Key Set to verify the token's signature #[get("/2/jwks")] fn jwks(state: &State) -> Json { let pub_key: RsaPublicKey = @@ -585,10 +586,7 @@ fn post_auth_action_test() { #[test] fn verify_token_signature_test() { - use jsonwebtoken::decode; - use jsonwebtoken::Algorithm; - use jsonwebtoken::DecodingKey; - use jsonwebtoken::Validation; + use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation}; use std::collections::HashSet; let client = &Client::tracked(create_server()).unwrap();