pub struct BackendOidcModeRuntime<MS>where
MS: PendingAuthStateMetadataRedemptionStore,{ /* private fields */ }Expand description
Unified backend-oidc runtime.
Parameterized by a metadata-redemption store (which may be a no-op for the pure preset). Provides the single implementation of authorize, callback, refresh, and metadata redemption.
Implementations§
Source§impl<MS> BackendOidcModeRuntime<MS>where
MS: PendingAuthStateMetadataRedemptionStore,
impl<MS> BackendOidcModeRuntime<MS>where
MS: PendingAuthStateMetadataRedemptionStore,
Sourcepub fn from_config(
config: BackendOidcModeRuntimeConfig<MS::Config>,
) -> BackendOidcModeRuntimeResult<Self>
pub fn from_config( config: BackendOidcModeRuntimeConfig<MS::Config>, ) -> BackendOidcModeRuntimeResult<Self>
Build the unified runtime from its config.
Sourcepub async fn from_resolved_config<PS>(
resolved: Option<&ResolvedBackendOidcModeConfig<PS::Config, MS::Config>>,
) -> BackendOidcModeRuntimeResult<(Self, Option<Arc<OidcClient<PS>>>)>
pub async fn from_resolved_config<PS>( resolved: Option<&ResolvedBackendOidcModeConfig<PS::Config, MS::Config>>, ) -> BackendOidcModeRuntimeResult<(Self, Option<Arc<OidcClient<PS>>>)>
Recommended entry point. Build both the runtime and the optional OIDC client from a resolved backend-oidc config.
Mirrors [AccessTokenSubstrateRuntime::from_resolved_config]:
BackendOidcModeRuntime::from_resolved_config(resolved_oidc.as_ref()).await?
──▸ (BackendOidcModeRuntime<MS>, Option<Arc<OidcClient<PS>>>)
AccessTokenSubstrateRuntime::from_resolved_config(&resolved_substrate).await?
──▸ (AccessTokenSubstrateRuntime, Option<Arc<OAuthResourceServerVerifier>>)Pass None when OIDC is disabled — the runtime is built from a default
config and oidc_client will be None.
§Type parameters
PS— pending OAuth store (Store type, e.g.MokaPendingOauthStore)MS— pending auth-state metadata redemption store (inferred fromSelf)
pub fn seal_refresh_token( &self, refresh_token: &str, ) -> BackendOidcModeRuntimeResult<SealedRefreshMaterial>
pub fn unseal_refresh_token( &self, material: &SealedRefreshMaterial, ) -> BackendOidcModeRuntimeResult<String>
pub fn auth_state_snapshot_from_code_callback( &self, result: &OidcCodeCallbackResult, options: &BackendOidcModeAuthStateOptions, ) -> BackendOidcModeRuntimeResult<AuthStateSnapshot>
pub fn auth_state_metadata_delta_from_refresh_result( current_metadata: Option<&CurrentAuthStateMetadataSnapshotPartial>, result: &OidcRefreshTokenResult, ) -> AuthStateMetadataDelta
Build an authorization URL for the OIDC code flow.
When post_auth_redirect_policy = resolved, the
post_auth_redirect_uri is resolved against the allowlist and
encoded into the OIDC state. When caller_validated, no redirect
URI is embedded.
Sourcepub async fn handle_code_callback<PS>(
&self,
oidc_client: &OidcClient<PS>,
search_params: OidcCodeCallbackSearchParams,
external_base_url: &Url,
auth_state_options: &BackendOidcModeAuthStateOptions,
redirect_url_override: Option<&str>,
) -> BackendOidcModeRuntimeResult<BackendOidcModeCodeCallbackResult>where
PS: PendingOauthStore,
pub async fn handle_code_callback<PS>(
&self,
oidc_client: &OidcClient<PS>,
search_params: OidcCodeCallbackSearchParams,
external_base_url: &Url,
auth_state_options: &BackendOidcModeAuthStateOptions,
redirect_url_override: Option<&str>,
) -> BackendOidcModeRuntimeResult<BackendOidcModeCodeCallbackResult>where
PS: PendingOauthStore,
Handle the OIDC code callback.
Sourcepub async fn handle_token_refresh<PS>(
&self,
oidc_client: &OidcClient<PS>,
payload: &BackendOidcModeRefreshPayload,
external_base_url: &Url,
) -> BackendOidcModeRuntimeResult<BackendOidcModeTokenRefreshResult>where
PS: PendingOauthStore,
pub async fn handle_token_refresh<PS>(
&self,
oidc_client: &OidcClient<PS>,
payload: &BackendOidcModeRefreshPayload,
external_base_url: &Url,
) -> BackendOidcModeRuntimeResult<BackendOidcModeTokenRefreshResult>where
PS: PendingOauthStore,
Handle a token refresh.
Sourcepub async fn handle_code_callback_inline<PS>(
&self,
oidc_client: &OidcClient<PS>,
search_params: OidcCodeCallbackSearchParams,
external_base_url: &Url,
auth_state_options: &BackendOidcModeAuthStateOptions,
redirect_url_override: Option<&str>,
) -> BackendOidcModeRuntimeResult<BackendOidcModeCodeCallbackResult>where
PS: PendingOauthStore,
pub async fn handle_code_callback_inline<PS>(
&self,
oidc_client: &OidcClient<PS>,
search_params: OidcCodeCallbackSearchParams,
external_base_url: &Url,
auth_state_options: &BackendOidcModeAuthStateOptions,
redirect_url_override: Option<&str>,
) -> BackendOidcModeRuntimeResult<BackendOidcModeCodeCallbackResult>where
PS: PendingOauthStore,
Handle the OIDC code callback for a JSON body response, embedding metadata inline.
Compared to handle_code_callback this
method:
- Skips
post_auth_redirect_uriresolution (irrelevant for body flows) - Skips
issue_metadata_snapshotand the associated store write - Embeds
AuthStateMetadataSnapshotdirectly in the response body
This removes one store write and one client redemption round-trip,
making it the preferred implementation for callback_body_return.
Sourcepub async fn handle_token_refresh_inline<PS>(
&self,
oidc_client: &OidcClient<PS>,
payload: &BackendOidcModeRefreshPayload,
) -> BackendOidcModeRuntimeResult<BackendOidcModeTokenRefreshResult>where
PS: PendingOauthStore,
pub async fn handle_token_refresh_inline<PS>(
&self,
oidc_client: &OidcClient<PS>,
payload: &BackendOidcModeRefreshPayload,
) -> BackendOidcModeRuntimeResult<BackendOidcModeTokenRefreshResult>where
PS: PendingOauthStore,
Handle a token refresh for a JSON body response, embedding metadata inline.
Compared to handle_token_refresh this
method:
- Skips
post_auth_redirect_uriresolution (irrelevant for body flows) - Skips
issue_metadata_deltaand the associated store write - Embeds
AuthStateMetadataDeltadirectly in the response body
This removes one store write and one client redemption round-trip,
making it the preferred implementation for refresh_body_return.
Sourcepub async fn redeem_metadata(
&self,
payload: &BackendOidcModeMetadataRedemptionRequest,
) -> BackendOidcModeRuntimeResult<Option<BackendOidcModeMetadataRedemptionResponse>>
pub async fn redeem_metadata( &self, payload: &BackendOidcModeMetadataRedemptionRequest, ) -> BackendOidcModeRuntimeResult<Option<BackendOidcModeMetadataRedemptionResponse>>
Redeem metadata by one-time redemption id.
Trait Implementations§
Source§impl<MS> Clone for BackendOidcModeRuntime<MS>where
MS: PendingAuthStateMetadataRedemptionStore + Clone,
impl<MS> Clone for BackendOidcModeRuntime<MS>where
MS: PendingAuthStateMetadataRedemptionStore + Clone,
Source§fn clone(&self) -> BackendOidcModeRuntime<MS>
fn clone(&self) -> BackendOidcModeRuntime<MS>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<MS> Freeze for BackendOidcModeRuntime<MS>where
MS: Freeze,
impl<MS> !RefUnwindSafe for BackendOidcModeRuntime<MS>
impl<MS> Send for BackendOidcModeRuntime<MS>
impl<MS> Sync for BackendOidcModeRuntime<MS>
impl<MS> Unpin for BackendOidcModeRuntime<MS>where
MS: Unpin,
impl<MS> UnsafeUnpin for BackendOidcModeRuntime<MS>where
MS: UnsafeUnpin,
impl<MS> !UnwindSafe for BackendOidcModeRuntime<MS>
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more