pub struct JwtVerifier { /* private fields */ }Expand description
Verifies JWT access tokens: signature (with the issuer’s published keys), issuer, audience, expiry and not-before.
The token’s sub becomes the Principal subject, and its scope
(space-separated) or scp claim the granted scopes.
use flymcprust_core::auth::JwtVerifier;
use flymcprust_core::transport::http::OAuth;
let resource = "https://mcp.example.com/mcp";
let verifier = JwtVerifier::builder("https://auth.example.com", resource).build()?;
let oauth = OAuth::builder(resource, verifier)
.authorization_server("https://auth.example.com")
.build()?;Implementations§
Source§impl JwtVerifier
impl JwtVerifier
Sourcepub fn builder(
issuer: impl Into<String>,
audience: impl Into<String>,
) -> JwtVerifierBuilder
pub fn builder( issuer: impl Into<String>, audience: impl Into<String>, ) -> JwtVerifierBuilder
Starts a verifier for tokens issued by issuer (exactly as in the
tokens’ iss claim) for audience (this server’s canonical URI,
the resource of OAuth).
By default the signing keys are discovered from the issuer’s metadata (RFC 8414, then OpenID Connect Discovery).
Trait Implementations§
Source§impl Clone for JwtVerifier
impl Clone for JwtVerifier
Source§impl Debug for JwtVerifier
impl Debug for JwtVerifier
Source§impl TokenVerifier for JwtVerifier
impl TokenVerifier for JwtVerifier
Source§fn verify<'a>(&'a self, token: &'a str) -> VerifyFuture<'a>
fn verify<'a>(&'a self, token: &'a str) -> VerifyFuture<'a>
Verifies
token (the value after Bearer ).Auto Trait Implementations§
impl !RefUnwindSafe for JwtVerifier
impl !UnwindSafe for JwtVerifier
impl Freeze for JwtVerifier
impl Send for JwtVerifier
impl Sync for JwtVerifier
impl Unpin for JwtVerifier
impl UnsafeUnpin for JwtVerifier
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