Skip to content

Commit

Permalink
Document what the default tolerance is
Browse files Browse the repository at this point in the history
Fixes #105
  • Loading branch information
jedisct1 committed Feb 3, 2024
1 parent a7f2814 commit 337607b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ let mut options = VerificationOptions::default();
options.accept_future = true;
// Accept tokens even if they have expired up to 15 minutes after the deadline,
// and/or they will be valid within 15 minutes.
// Note that 15 minutes is the default, since it is very common for clocks to be slightly off.
options.time_tolerance = Some(Duration::from_mins(15));
// Reject tokens if they were issued more than 1 hour ago
options.max_validity = Some(Duration::from_hours(1));
Expand Down
1 change: 1 addition & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub struct VerificationOptions {
pub allowed_audiences: Option<HashSet<String>>,

/// How much clock drift to tolerate when verifying token timestamps
/// Default is 15 minutes, to work around common issues with clocks that are not perfectly accurate
pub time_tolerance: Option<Duration>,

/// Reject tokens created more than `max_validity` ago
Expand Down

0 comments on commit 337607b

Please sign in to comment.