pub trait TokenValidator:
Send
+ Sync
+ 'static {
// Required method
fn validate<'a>(
&'a self,
token: &'a str,
) -> BoxFuture<'a, Result<TokenInfo, String>>;
}Expand description
Token validator trait for authenticating WebSocket connections.
Implementations validate bearer tokens (JWT or otherwise) and return the validated token information including user identity and expiration.
The trait is object-safe (returns BoxFuture) so it can be stored as
Arc<dyn TokenValidator> and mounted in build_base_router without
adding a type parameter to Server<A>.
§Production implementation
JwtTokenValidator wraps the existing OidcValidator
from fraiseql-core, reusing the same JWT validation path as the GraphQL
endpoint’s OIDC middleware.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".