Skip to content

Commit

Permalink
chore: remove unnecessary comments, printlns, and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
raimundo-henriques committed Dec 5, 2023
1 parent ebd7ac3 commit e48b7cd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 70 deletions.
75 changes: 17 additions & 58 deletions endpoint/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions endpoint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 0 additions & 6 deletions endpoint/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ impl<'r> FromRequest<'r> for UserToken {
req: &'r Request<'_>,
) -> request::Outcome<Self, status::Custom<UserTokenError>> {
if let Some(authen_header) = req.headers().get_one("Authorization") {
println!(
"request state: {:?}",
req.rocket().state::<KeyPair>().unwrap()
);
let authen_str = authen_header.to_string();
if authen_str.starts_with("Bearer") {
let token = authen_str[6..authen_str.len()].trim();
Expand All @@ -154,8 +150,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();

Expand Down
6 changes: 2 additions & 4 deletions endpoint/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fn openid_configuration() -> Json<OpenIdConfiguration> {
Json(openid_conf)
}

/// endpoint to retrieve the Json Web Key Set to verify the token's signature
#[get("/2/jwks")]
fn jwks(state: &State<KeyPair>) -> Json<JwkSet> {
let pub_key: RsaPublicKey =
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e48b7cd

Please sign in to comment.