parent
2e8aa8d3f8
commit
733d29aa87
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "jsonwebtoken"
|
name = "jsonwebtoken"
|
||||||
version = "8.0.0-beta.3"
|
version = "8.0.0-beta.4"
|
||||||
authors = ["Vincent Prouillet <hello@vincentprouillet.com>"]
|
authors = ["Vincent Prouillet <hello@vincentprouillet.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -17,7 +17,7 @@ serde = {version = "1.0", features = ["derive"] }
|
||||||
ring = { version = "0.16.5", features = ["std"] }
|
ring = { version = "0.16.5", features = ["std"] }
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
# For PEM decoding
|
# For PEM decoding
|
||||||
pem = "0.8"
|
pem = "1"
|
||||||
simple_asn1 = "0.5"
|
simple_asn1 = "0.5"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -70,19 +70,7 @@ pub struct Validation {
|
||||||
impl Validation {
|
impl Validation {
|
||||||
/// Create a default validation setup allowing the given alg
|
/// Create a default validation setup allowing the given alg
|
||||||
pub fn new(alg: Algorithm) -> Validation {
|
pub fn new(alg: Algorithm) -> Validation {
|
||||||
Validation {
|
Validation { algorithms: vec![alg], ..Default::default() }
|
||||||
algorithms: vec![alg],
|
|
||||||
leeway: 0,
|
|
||||||
|
|
||||||
validate_exp: true,
|
|
||||||
validate_nbf: false,
|
|
||||||
|
|
||||||
iss: None,
|
|
||||||
sub: None,
|
|
||||||
aud: None,
|
|
||||||
|
|
||||||
validate_signature: true,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `aud` is a collection of one or more acceptable audience members
|
/// `aud` is a collection of one or more acceptable audience members
|
||||||
|
@ -103,6 +91,24 @@ impl Validation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Validation {
|
||||||
|
fn default() -> Self {
|
||||||
|
Validation {
|
||||||
|
algorithms: vec![Algorithm::HS256],
|
||||||
|
leeway: 0,
|
||||||
|
|
||||||
|
validate_exp: true,
|
||||||
|
validate_nbf: false,
|
||||||
|
|
||||||
|
iss: None,
|
||||||
|
sub: None,
|
||||||
|
aud: None,
|
||||||
|
|
||||||
|
validate_signature: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets the current timestamp in the format JWT expect
|
/// Gets the current timestamp in the format JWT expect
|
||||||
pub fn get_current_timestamp() -> u64 {
|
pub fn get_current_timestamp() -> u64 {
|
||||||
let start = SystemTime::now();
|
let start = SystemTime::now();
|
||||||
|
|
Loading…
Reference in New Issue