tapis-core
Shared traits and types for the Tapis Rust SDK.
This crate is intentionally small and has no HTTP or network dependencies. It exists solely to break the circular-dependency problem that would arise if service crates directly referenced tapis-authenticator for token refresh.
What's in this crate
TokenProvider
An async trait that defines the contract for obtaining a fresh Tapis JWT:
Return Some(jwt_string) to supply a fresh token, or None to leave the current token unchanged (e.g., on a transient error).
Dependency graph
tapis-jobs ──dep──> tapis-core <──impl── tapis-authenticator
tapis-systems ────> ▲
tapis-apps ───────> │
... (no service crate depends on tapis-authenticator)
tapis-authenticator can implement TokenProvider and pass it into any service client without creating a cycle.
Usage
Add to your Cargo.toml:
[]
= "0.3.1"
= "0.1"
Implement the trait on any type that can produce a token:
use Arc;
use async_trait;
use TokenProvider;
;
Then pass it to any service client constructor:
use TapisJobs;
let provider: = new;
let jobs = with_token_provider?;
Note: If you are using the umbrella crate,
TokenProvideris re-exported astapis_sdk::core::TokenProvider— you do not need to addtapis-coreas a direct dependency.
Infinite-loop protection
RefreshMiddleware (in each service crate) skips the refresh call when the outgoing request URL contains /oauth2/tokens or /v3/tokens, preventing the token provider from recursively triggering itself.
License
BSD-3-Clause. See LICENSE.