Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmichels committed Apr 29, 2024
1 parent 070e5ba commit 09fc7d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ struct TokenResponse {
}

#[derive(Deserialize)]
struct Claims {
iss: String, // Optional. Issuer
nbf: Option<usize>, // Optional. Not Before (as UTC timestamp)
sub: String, // Optional. Subject (whom token refers to)
}
struct Claims {}

const ACCEPTABLE_ALGORITHMS: [Algorithm; 3] =
[Algorithm::RS256, Algorithm::RS384, Algorithm::RS512];
Expand Down Expand Up @@ -128,7 +124,7 @@ async fn handle_token_request(
};

// TODO: is there anything to do with claims?
let claims = match decode::<Claims>(&token, &decoding_key, &validation) {
let _claims = match decode::<Claims>(&token, &decoding_key, &validation) {
Ok(claims) => claims,
Err(e) => {
error!("token failed to decode: {}", e);
Expand All @@ -140,7 +136,7 @@ async fn handle_token_request(

let requested_scopes = payload.scopes;
for (scope_name, scope_value) in requested_scopes.iter() {
if !policy.check_scope_allowed(&scope_name, &scope_value) {
if !policy.check_scope_allowed(scope_name, scope_value) {
debug!("scope {}:{} not allowed", scope_name, scope_value);
return (StatusCode::UNAUTHORIZED, Json(None));
}
Expand Down
2 changes: 1 addition & 1 deletion src/tailscale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl AccessTokenRequester for OAuth2Requester {
}
format!("{}:{}", key, value)
})
.map(|s| Scope::new(s))
.map(Scope::new)
.collect();

let response = self
Expand Down

0 comments on commit 09fc7d3

Please sign in to comment.