Slight tweaks
This commit is contained in:
parent
636c0dc203
commit
6262b4700b
|
@ -206,26 +206,9 @@ pub fn dangerous_insecure_decode<T: DeserializeOwned>(token: &str) -> Result<Tok
|
||||||
Ok(TokenData { header, claims: decoded_claims })
|
Ok(TokenData { header, claims: decoded_claims })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decode a JWT without any signature verification/validations.
|
/// Decode a JWT without any signature verification/validations. DEPRECATED.
|
||||||
///
|
|
||||||
/// NOTE: Do not use this unless you know what you are doing! If the token's signature is invalid, it will *not* return an error.
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// use serde::{Deserialize, Serialize};
|
|
||||||
/// use jsonwebtoken::{dangerous_unsafe_decode, Validation, Algorithm};
|
|
||||||
///
|
|
||||||
/// #[derive(Debug, Serialize, Deserialize)]
|
|
||||||
/// struct Claims {
|
|
||||||
/// sub: String,
|
|
||||||
/// company: String
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// let token = "a.jwt.token".to_string();
|
|
||||||
/// // Claims is a struct that implements Deserialize
|
|
||||||
/// let token_message = dangerous_unsafe_decode::<Claims>(&token);
|
|
||||||
/// ```
|
|
||||||
#[deprecated(
|
#[deprecated(
|
||||||
note = "This function has been renamed to `dangerous_unsafe_decode` and will be removed in a later version."
|
note = "This function has been renamed to `dangerous_insecure_decode` and will be removed in a later version."
|
||||||
)]
|
)]
|
||||||
pub fn dangerous_unsafe_decode<T: DeserializeOwned>(token: &str) -> Result<TokenData<T>> {
|
pub fn dangerous_unsafe_decode<T: DeserializeOwned>(token: &str) -> Result<TokenData<T>> {
|
||||||
dangerous_insecure_decode(token)
|
dangerous_insecure_decode(token)
|
||||||
|
|
|
@ -2,9 +2,6 @@ use std::error::Error as StdError;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::result;
|
use std::result;
|
||||||
|
|
||||||
use base64;
|
|
||||||
use serde_json;
|
|
||||||
|
|
||||||
/// A crate private constructor for `Error`.
|
/// A crate private constructor for `Error`.
|
||||||
pub(crate) fn new_error(kind: ErrorKind) -> Error {
|
pub(crate) fn new_error(kind: ErrorKind) -> Error {
|
||||||
Error(Box::new(kind))
|
Error(Box::new(kind))
|
||||||
|
|
Loading…
Reference in New Issue