pub struct AuthorityBuilder<Claims, Algorithm, RefreshAuthorizer, Args>where
Algorithm: Algorithm,
Algorithm::SigningKey: Clone,
Algorithm::VerifyingKey: Clone,{ /* private fields */ }
Expand description
Builder for Authority
.
Implementations§
source§impl<Claims: Clone, Algorithm, RefreshAuthorizer: Clone, Args: Clone> AuthorityBuilder<Claims, Algorithm, RefreshAuthorizer, Args>where
Algorithm: Algorithm + Clone,
Algorithm::SigningKey: Clone,
Algorithm::VerifyingKey: Clone,
impl<Claims: Clone, Algorithm, RefreshAuthorizer: Clone, Args: Clone> AuthorityBuilder<Claims, Algorithm, RefreshAuthorizer, Args>where
Algorithm: Algorithm + Clone,
Algorithm::SigningKey: Clone,
Algorithm::VerifyingKey: Clone,
The refresh_authorizer
is called every time,
when a client with an expired access token but a valid refresh token
tries to fetch a resource protected by the jwt middleware.
By returning the Ok
variant your grand the client permission to get a new access token.
In contrast, by returning the Err
variant you deny the request. The actix_web::Error
returned in this case
will be passed along as a wrapped internal AuthError
back to the client (There are options to remap this [actix-error-mapper]).
Since refresh_authorizer
has to implement the Handler
trait,
you are able to access your regular application an request state from within
the function. This allows you to perform Database Check etc…
Not Passing a CookieSigner
struct will make your middleware unable to refresh the access token automatically.
You will have to provide a algorithm manually in this case because the Authority can not pull it from the cookie_signer
field.
Please referee to the structs own documentation for more details.
sourcepub fn access_token_name(&mut self, value: &'static str) -> &mut Self
pub fn access_token_name(&mut self, value: &'static str) -> &mut Self
Depending on wether a CookieSigner
is set, setting this field will have no affect.
Defaults to the value of the access_token_name
field set on the cookie_signer
, if the cookie_signer
is not set,
this defaults to "access_token"
.
sourcepub fn renew_access_token_automatically(&mut self, value: bool) -> &mut Self
pub fn renew_access_token_automatically(&mut self, value: bool) -> &mut Self
Self explanatory, if set to false the clients access token will not be automatically refreshed.
Defaults to true
sourcepub fn refresh_token_name(&mut self, value: &'static str) -> &mut Self
pub fn refresh_token_name(&mut self, value: &'static str) -> &mut Self
Depending on wether a CookieSigner
is set, setting this field will have no affect.
Defaults to the value of the refresh_token_name
field set on the cookie_signer
, if the cookie_signer
is not set,
this defaults to "refresh_token"
.
sourcepub fn renew_refresh_token_automatically(&mut self, value: bool) -> &mut Self
pub fn renew_refresh_token_automatically(&mut self, value: bool) -> &mut Self
If set to true the clients refresh token will automatically refreshed, this allows clients to basically stay authenticated over a infinite amount of time, so i don’t recommend it.
Defaults to false
sourcepub fn verifying_key(&mut self, value: Algorithm::VerifyingKey) -> &mut Self
pub fn verifying_key(&mut self, value: Algorithm::VerifyingKey) -> &mut Self
Key used to verify integrity of access and refresh token.
sourcepub fn algorithm(&mut self, value: Algorithm) -> &mut Self
pub fn algorithm(&mut self, value: Algorithm) -> &mut Self
The Cryptographic signing algorithm used in the process of creation of access and refresh tokens.
Please referee to the Supported algorithms
section of the jwt-compact
crate
for a comprehensive list of the supported algorithms.
Defaults to the value of the algorithm
field set on the cookie_signer
, if the cookie_signer
is not set,
this field needs to be set.
sourcepub fn time_options(&mut self, value: TimeOptions) -> &mut Self
pub fn time_options(&mut self, value: TimeOptions) -> &mut Self
Used in the creating of the token
, the current timestamp is taken from this, but please referee to the Structs documentation.
Defaults to the value of the time_options
field set on the cookie_signer
, if the cookie_signer
is not set,
this field needs to be set.
Trait Implementations§
source§impl<Claims: Clone, Algorithm, RefreshAuthorizer: Clone, Args: Clone> Clone for AuthorityBuilder<Claims, Algorithm, RefreshAuthorizer, Args>where
Algorithm: Algorithm + Clone,
Algorithm::SigningKey: Clone,
Algorithm::VerifyingKey: Clone + Clone,
impl<Claims: Clone, Algorithm, RefreshAuthorizer: Clone, Args: Clone> Clone for AuthorityBuilder<Claims, Algorithm, RefreshAuthorizer, Args>where
Algorithm: Algorithm + Clone,
Algorithm::SigningKey: Clone,
Algorithm::VerifyingKey: Clone + Clone,
source§fn clone(&self) -> AuthorityBuilder<Claims, Algorithm, RefreshAuthorizer, Args>
fn clone(&self) -> AuthorityBuilder<Claims, Algorithm, RefreshAuthorizer, Args>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more