Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelvanstraten committed Mar 26, 2024
1 parent 509b4de commit 9a59530
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ version = "4.2.1"
default-features = true

[dev-dependencies.serde]
serde = "1.0.145"
version = "1.0.145"
features = ["derive"]

[dev-dependencies.jwt-compact]
Expand Down
2 changes: 1 addition & 1 deletion derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn from_request(tokenstream: TokenStream) -> TokenStream {

let error = format!(
"could not extract type \"{}\" from HttpRequest extensions",
ident.to_string()
ident
);

type_aware_impl(
Expand Down
6 changes: 3 additions & 3 deletions src/token_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Duration;

use actix_web::cookie::Cookie;
use actix_web::http::header::HeaderValue;
use chrono::Duration as ChronoDuration;
use chrono::TimeDelta;
use derive_builder::Builder;
use jwt_compact::Algorithm;
use jwt_compact::AlgorithmExt;
Expand Down Expand Up @@ -118,7 +118,7 @@ where
Defaults to `TimeOptions::from_leeway(Duration::seconds(0))`
*/
#[builder(default = "TimeOptions::from_leeway(ChronoDuration::seconds(0))")]
#[builder(default = "TimeOptions::from_leeway(TimeDelta::try_seconds(0).unwrap())")]
pub(crate) time_options: TimeOptions,
#[doc(hidden)]
#[builder(setter(skip), default = "PhantomData")]
Expand Down Expand Up @@ -266,7 +266,7 @@ where
) -> AuthResult<String> {
let token_claims = TokenClaims::new(claims).set_duration_and_issuance(
&self.time_options,
ChronoDuration::from_std(token_lifetime).unwrap(),
TimeDelta::from_std(token_lifetime).unwrap(),
);

self.algorithm
Expand Down
5 changes: 4 additions & 1 deletion src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ where
{
match UntrustedToken::new(&value) {
Ok(untrusted_token) => {
match algorithm.validate_integrity::<Claims>(&untrusted_token, verifying_key) {
match algorithm
.validator(verifying_key)
.validate(&untrusted_token)
{
Ok(token) => match token.claims().validate_expiration(time_options) {
Ok(_) => Ok(token),
Err(err) => Err(AuthError::TokenValidation(err)),
Expand Down

0 comments on commit 9a59530

Please sign in to comment.