pub struct VerifyIdTokenLayer { /* private fields */ }Expand description
A tower layer that lets a request through only with a valid Google ID token in its
authorization: Bearer header, and puts the token’s claims into the request’s
extensions for the VerifiedIdToken extractor.
Requests it refuses never reach the inner service. They get an empty response:
- 401 with
www-authenticate: Bearerwhen there is no bearer token; - 401 with
www-authenticate: Bearer error="invalid_token"when the token does not verify; - 503 when the signing keys cannot be fetched;
- 403 when the token verifies but
authorizerefuses it.
Implementations§
Source§impl VerifyIdTokenLayer
impl VerifyIdTokenLayer
Sourcepub fn new(verifier: Arc<IdTokenVerifier>) -> Self
pub fn new(verifier: Arc<IdTokenVerifier>) -> Self
A layer that admits every token verifier accepts.
Admits only the verified tokens for which authorize returns true, such as those
of an allowlist of callers; the others get 403. Replaces any earlier authorize.
Trait Implementations§
Source§impl Clone for VerifyIdTokenLayer
impl Clone for VerifyIdTokenLayer
Auto Trait Implementations§
impl !RefUnwindSafe for VerifyIdTokenLayer
impl !UnwindSafe for VerifyIdTokenLayer
impl Freeze for VerifyIdTokenLayer
impl Send for VerifyIdTokenLayer
impl Sync for VerifyIdTokenLayer
impl Unpin for VerifyIdTokenLayer
impl UnsafeUnpin for VerifyIdTokenLayer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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