validate_launch

Function validate_launch 

Source
pub async fn validate_launch(
    state: &str,
    oidc_state_store: &dyn OIDCStateStore,
    id_token: &IdToken,
) -> Result<(), OIDCError>
Expand description

Validate the launch request #arguements

  • state - The state parameter from the launch request parameters
  • oidc_state_store - The OIDC state store that implements the OIDCStateStore trait
  • id_token - The id token from the launch request #returns
  • Result<(), OIDCError> - Returns an error if the launch is invalid #example
use atomic_lti::validate::validate_launch;
use atomic_lti::id_token::IdToken;
use atomic_lti::params::{LaunchParams, LaunchSettings};
use atomic_lti::jwks::Jwks;
use atomic_lti::platforms::{get_jwk_set, PlatformStore};
use atomic_lti::stores::oidc_state_store::OIDCStateStore;

pub async fn launch( req: HttpRequest, params: &LaunchParams, platform_store: &dyn PlatformStore, oidc_state_store: &dyn OIDCStateStore, hashed_script_name: &str, ) -> Result<HttpResponse, AtomicToolError> { let jwk_server_url = platform_store.get_jwk_server_url().await?; let jwk_set = get_jwk_set(jwk_server_url).await?; let id_token = decode(&params.id_token, &jwk_set)?; let requested_target_link_uri = req.uri().to_string(); validate_launch(&params.state, oidc_state_store, &id_token).await?;

// … additional code }