Struct mz_frontegg_auth::FronteggAuthentication
source · pub struct FronteggAuthentication { /* private fields */ }
Implementations§
source§impl FronteggAuthentication
impl FronteggAuthentication
sourcepub fn new(config: FronteggConfig) -> Self
pub fn new(config: FronteggConfig) -> Self
Creates a new frontegg auth. jwk_rsa_pem
is the RSA public key to
validate the JWTs. tenant_id
must be parseable as a UUID.
sourcepub async fn exchange_password_for_token(
&self,
password: &str
) -> Result<ApiTokenResponse, FronteggError>
pub async fn exchange_password_for_token(
&self,
password: &str
) -> Result<ApiTokenResponse, FronteggError>
Exchanges a password for a JWT token.
sourcepub async fn exchange_client_secret_for_token(
&self,
client_id: Uuid,
secret: Uuid
) -> Result<ApiTokenResponse, FronteggError>
pub async fn exchange_client_secret_for_token(
&self,
client_id: Uuid,
secret: Uuid
) -> Result<ApiTokenResponse, FronteggError>
Exchanges a client id and secret for a jwt token.
sourcepub fn validate_access_token(
&self,
token: &str,
expected_email: Option<&str>
) -> Result<Claims, FronteggError>
pub fn validate_access_token(
&self,
token: &str,
expected_email: Option<&str>
) -> Result<Claims, FronteggError>
Validates an access token and its tenant_id
.
sourcepub fn continuously_validate_access_token(
&self,
token: ApiTokenResponse,
expected_email: String,
claims_processor: impl FnMut(Claims)
) -> Result<impl Future<Output = ()>, FronteggError>
pub fn continuously_validate_access_token(
&self,
token: ApiTokenResponse,
expected_email: String,
claims_processor: impl FnMut(Claims)
) -> Result<impl Future<Output = ()>, FronteggError>
Continuously validates and refreshes an access token.
Validates the provided access token once, as validate_access_token
does. If it is valid, returns a future that will attempt to refresh
the access token before it expires, resolving iff the token expires
or fails to refresh.
The claims contained in the provided access token and all updated
claims will be processed by claims_processor
.
pub fn tenant_id(&self) -> Uuid
pub fn admin_role(&self) -> &str
Trait Implementations§
source§impl Clone for FronteggAuthentication
impl Clone for FronteggAuthentication
source§fn clone(&self) -> FronteggAuthentication
fn clone(&self) -> FronteggAuthentication
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for FronteggAuthentication
impl Send for FronteggAuthentication
impl Sync for FronteggAuthentication
impl Unpin for FronteggAuthentication
impl !UnwindSafe for FronteggAuthentication
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request