pub fn decode_authn_request_base64_encoded(req: String) -> Result<String, AuthnDecodeError> {
    let base64_decoded_samlrequest: Vec<u8> = match base64::decode(req) {
        Ok(value) => {
            debug!("Successfully Base64 Decoded the SAMLRequest");
            value
        }
        Err(err) => {
            return Err(AuthnDecodeError::new(format!(
                "Failed to base64 decode SAMLRequest in saml_redirect_get {:?}",
                err
            )));
        }
    };
    // here we try and use libflate to deflate the base64-decoded bytes because compression is used
    let inflated_result = match inflate_bytes(&base64_decoded_samlrequest) {
        Ok(value) => {
            debug!(
                "Successfully inflated the base64-decoded bytes: {:?}",
                from_utf8(&value).unwrap_or("Couldn't utf-8 decode this mess")
            );
            value
        }
        // if it fails, it's probably fine to return the bare bytes as they're already a string?
        Err(error) => {
            debug!("Failed to inflate bytes ({:?})", error);
            base64_decoded_samlrequest
        }
    };
    match from_utf8(&inflated_result) {
        Ok(value) => Ok(value.to_string()),
        _ => Err(AuthnDecodeError::new(format!(
            "Failed to utf-8 encode the result: {:?}",
            inflated_result
        ))),
    }
}
/// Removes base64 encoding and also deflates the input String.
Removes base64 encoding and also deflates the input String.
Removes base64 encoding and also deflates the input String .
pub fn decode_authn_request_base64_encoded(req: String) -> Result<String, AuthnDecodeError> {
    let base64_decoded_samlrequest: Vec<u8> = match base64::decode(req) {
        Ok(value) => {
            debug!("Successfully Base64 Decoded the SAMLRequest");
            value
        }
        Err(err) => {
            return Err(AuthnDecodeError::new(format!(
                "Failed to base64 decode SAMLRequest in saml_redirect_get {:?}",
                err
            )));
        }
    };
    // here we try and use libflate to deflate the base64-decoded bytes because compression is used
    let inflated_result = match inflate_bytes(&base64_decoded_samlrequest) {
        Ok(value) => {
            debug!(
                "Successfully inflated the base64-decoded bytes: {:?}",
                from_utf8(&value).unwrap_or("Couldn't utf-8 decode this mess")
            );
            value
        }
        // if it fails, it's probably fine to return the bare bytes as they're already a string?
        Err(error) => {
            debug!("Failed to inflate bytes ({:?})", error);
            base64_decoded_samlrequest
        }
    };
    match from_utf8(&inflated_result) {
        Ok(value) => Ok(value.to_string()),
        _ => Err(AuthnDecodeError::new(format!(
            "Failed to utf-8 encode the result: {:?}",
            inflated_result
        ))),
    }
}
pub fn decode_authn_request_base64_encoded ( req : String ) -> Result < String , AuthnDecodeError > { let base64_decoded_samlrequest : Vec < u8 > = match base64 :: decode ( req ) { Ok ( value ) => { debug ! ( " " ) ; value } Err ( err ) => { return Err ( AuthnDecodeError :: new ( format ! ( " " err ) ) ) ; } } ; // here we try and use libflate to deflate the base64-decoded bytes because compression is used let inflated_result = match inflate_bytes ( & base64_decoded_samlrequest ) { Ok ( value ) => { debug ! ( " " from_utf8 ( value ) unwrap_or ( " " ) ) ; value } // if it fails, it's probably fine to return the bare bytes as they're already a string? Err ( error ) => { debug ! ( " " error ) ; base64_decoded_samlrequest } } ; match from_utf8 ( & inflated_result ) { Ok ( value ) => Ok ( value . to_string ( ) ) , _ => Err ( AuthnDecodeError :: new ( format ! ( " " inflated_result ) ) ) , } }
Removes base64 encoding and also deflates the input String.
Removes base64 encoding and also deflates the input String .
req
String
req
String