Skip to main content

MetadataDocumentLoader

Trait MetadataDocumentLoader 

Source
pub trait MetadataDocumentLoader {
    // Required method
    fn fetch_metadata_document(
        &self,
        issuer: &str,
        client_id: &ClientId,
    ) -> impl Future<Output = Result<RegisteredClient, RegistrarError>> + Send;
}
Expand description

Fetches the Client ID Metadata Document a client published.

The counterpart to DynamicRegistrar, and separate for the same reason. The two differ in what they establish as well as in what they send: this one yields no secret at all.

§Examples

use protocol_droid::application::oauth::registration::{
    MetadataDocumentLoader, RegistrarError,
};
use protocol_droid::domain::oauth::registration::{ClientId, RegisteredClient};

struct RefusesEverything;

impl MetadataDocumentLoader for RefusesEverything {
    async fn fetch_metadata_document(
        &self,
        _issuer: &str,
        _client_id: &ClientId,
    ) -> Result<RegisteredClient, RegistrarError> {
        Err(RegistrarError::Refused { status: 404 })
    }
}

Required Methods§

Source

fn fetch_metadata_document( &self, issuer: &str, client_id: &ClientId, ) -> impl Future<Output = Result<RegisteredClient, RegistrarError>> + Send

Fetch the document published at client_id and verify what it claims.

§Errors

RegistrarError if the document could not be fetched, or RegistrarError::Document if it does not claim the URL it was served from. The two are distinct because the use case reacts differently.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§