matrix_sdk::oidc::requests::authorization_code

Function build_par_authorization_url

Source
pub async fn build_par_authorization_url(
    http_service: &BoxCloneSyncService<Request<Bytes>, Response<Bytes>, Box<dyn Error + Send + Sync>>,
    client_credentials: ClientCredentials,
    par_endpoint: &Url,
    authorization_endpoint: Url,
    authorization_data: AuthorizationRequestData,
    now: DateTime<Utc>,
    rng: &mut impl Rng,
) -> Result<(Url, AuthorizationValidationData), AuthorizationError>
Available on crate feature experimental-oidc only.
Expand description

Make a Pushed Authorization Request and build the URL for authenticating at the Authorization endpoint.

§Arguments

  • http_service - The service to use for making HTTP requests.

  • client_credentials - The credentials obtained when registering the client.

  • par_endpoint - The URL of the issuer’s Pushed Authorization Request endpoint.

  • authorization_endpoint - The URL of the issuer’s Authorization endpoint.

  • authorization_data - The data necessary to build the authorization request.

  • now - The current time.

  • rng - A random number generator.

§Returns

A URL to be opened in a web browser where the end-user will be able to authorize the given scope, and the AuthorizationValidationData to validate this request.

The redirect URI will receive parameters in its query:

  • A successful response will receive a code and a state.

  • If the authorization fails, it should receive an error parameter with a ClientErrorCode and optionally an error_description.

§Errors

Returns an error if the request fails, the response is invalid or building the URL fails.