Struct aliri_oauth2::Authority
source · pub struct Authority { /* private fields */ }
Expand description
An authority backed by a potentially dynamic JSON Web Key Set (JWKS) held by a remote source
Implementations§
source§impl Authority
impl Authority
sourcepub fn new(jwks: Jwks, validator: CoreValidator) -> Self
pub fn new(jwks: Jwks, validator: CoreValidator) -> Self
Constructs a new JWKS authority from an existing JWKS
sourcepub async fn new_from_url(
jwks_url: String,
validator: CoreValidator
) -> Result<Self, Error>
Available on crate feature reqwest
only.
pub async fn new_from_url( jwks_url: String, validator: CoreValidator ) -> Result<Self, Error>
reqwest
only.Constructs a new JWKS authority from a URL
sourcepub fn spawn_refresh(&self, interval: Duration)
Available on crate feature tokio
only.
pub fn spawn_refresh(&self, interval: Duration)
tokio
only.A non-terminating future that will automatically refresh the JWKS using the configured interval
sourcepub async fn refresh(&self) -> Result<(), Error>
Available on crate feature reqwest
only.
pub async fn refresh(&self) -> Result<(), Error>
reqwest
only.Refreshes the JWKS from the remote URL
No retries are attempted. If the attempt to refresh the JWKS from the remote URL fails, no change is made to the internal JWKS.
sourcepub fn verify_token<T>(
&self,
token: &JwtRef,
policy: &ScopePolicy
) -> Result<T, AuthorityError>
pub fn verify_token<T>( &self, token: &JwtRef, policy: &ScopePolicy ) -> Result<T, AuthorityError>
Authenticates the token and checks access according to the policy
§Errors
Returns an error if the token is invalid or is not authorized by the policy
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Authority
impl !RefUnwindSafe for Authority
impl Send for Authority
impl Sync for Authority
impl Unpin for Authority
impl !UnwindSafe for Authority
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more