pub trait ProviderStrategy: Send + Sync {
// Required method
fn classify_token_error(
&self,
ctx: &ProviderErrorContext,
) -> ProviderErrorKind;
// Provided method
fn augment_token_request(
&self,
_grant: GrantType,
_form: &mut BTreeMap<String, String>,
) { ... }
}Expand description
Strategy hook that allows providers to decorate requests and classify errors.
Implementors are required to be Send + Sync, and the hooks intentionally use
crate-owned data types so downstream crates never depend on reqwest-specific
structures. Override only what you need—augment_token_request has a default
no-op implementation.
Required Methods§
Sourcefn classify_token_error(&self, ctx: &ProviderErrorContext) -> ProviderErrorKind
fn classify_token_error(&self, ctx: &ProviderErrorContext) -> ProviderErrorKind
Maps low-level HTTP/JSON errors into the broker taxonomy for a token request.
Provided Methods§
Sourcefn augment_token_request(
&self,
_grant: GrantType,
_form: &mut BTreeMap<String, String>,
)
fn augment_token_request( &self, _grant: GrantType, _form: &mut BTreeMap<String, String>, )
Gives providers a chance to add custom form parameters before dispatching.
The default implementation does nothing, which is enough for most providers.
Override the hook when a provider requires extra fields (audience, resource,
etc.). The method works on a plain BTreeMap so implementations remain HTTP
client agnostic.