Struct auth0_rs::Auth0[][src]

pub struct Auth0 {
    pub key_map: HashMap<String, JsonWebKey>,
}
Expand description

Main struct for auth0_rs library

Fields

key_map: HashMap<String, JsonWebKey>

HashMap of JSON web keys with key to be kid (key ID), and value to be JsonWebKey.

Implementations

Create new Auth0 instance from a JSON web key set (JWKS) str.

Example:

use auth0_rs::Auth0;
let keys = r#"
{
    "keys":[
        {
          "kty": "RSA",
          "n": "nzyis1ZjfNB0bBgKFMSvvkTtwlvBsaJq7S5wA-kzeVOVpVWwkWdVha4s38XM_pa_yr47av7-z3VTmvDRyAHcaT92whREFpLv9cj5lTeJSibyr_Mrm_YtjCZVWgaOYIhwrXwKLqPr_11inWsAkfIytvHWTxZYEcXLgAXFuUuaS3uF9gEiNQwzGTU1v0FqkqTBr4B8nW3HCN47XUu0t8Y0e-lf4s4OxQawWD79J9_5d3Ry0vbV3Am1FtGJiJvOwRsIfVChDpYStTcHTCMqtvWbV6L11BWkpzGXSW4Hv43qa-GSYOD2QU68Mb59oSk2OB-BtOLpJofmbGEGgvmwyCI9Mw",
          "e": "AQAB",
          "alg": "RS256",
          "kid": "auth0_rs",
          "use": "sig"
        }
    ]
}
"#;
let auth0 = Auth0::new(keys).unwrap();

The validated token above would reveal the following claims

{
"aud": "https://github.com/digizeph/auth0_rs",
"exp": 32520059430,
"iat": 1625840745,
"iss": "https://jwt.io",
"sub": "first-client",
}

Update JSON web keys.

Validate token and return claims as Claims

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.