fn parse_authn_tokenizer_attribute(
    local: StrSpan,
    value: StrSpan,
    mut req: AuthnRequestParser,
) -> Result<AuthnRequestParser, AuthnDecodeError> {
    match local.to_lowercase().as_str() {
        "destination" => {
            req.destination = Some(value.to_string());
        }
        "id" => {
            req.relay_state = Some(value.to_string());
        }
        "issueinstant" => {
            debug!("Found issueinstant: {}", value.to_string());

            // Date parsing... 2021-07-19T12:06:25Z
            let parsed_datetime = DateTime::parse_from_rfc3339(&value);
            debug!("parsed_datetime: {:?}", parsed_datetime);
            match parsed_datetime {
                Ok(value) => {
                    debug!("Setting issue_instant");
                    let result: DateTime<Utc> = value.into();
                    req.issue_instant = Some(result);
                }
                Err(error) => {
                    eprintln!(
                        "Failed to cast datetime source={:?}, error=\"{}\"",
                        value.to_string(),
                        error
                    );
                }
            };
        }
        "assertionconsumerserviceurl" => {
            req.consumer_service_url = Some(value.to_string());
        }
        "version" => {
            if value.to_string() != "2.0" {
                return Err(AuthnDecodeError::new(format!(
                    "SAML Request where version!=2.0 ({}), this is probably bad.",
                    value.to_string()
                )));
            }
            req.version = value.to_string();
        }
        _ => debug!(
            "Found tokenizer attribute={}, value={}",
            local.to_lowercase().as_str(),
            value.to_string()
        ),
    }

    //eprintln!("after block {:?}", req.issue_instant);
    Ok(req)
}
/// Used inside AuthnRequestParser to help parse the AuthN request
Used inside AuthnRequestParser to help parse the AuthN request
Used inside AuthnRequestParser to help parse the AuthN request
fn parse_authn_tokenizer_attribute(
    local: StrSpan,
    value: StrSpan,
    mut req: AuthnRequestParser,
) -> Result<AuthnRequestParser, AuthnDecodeError> {
    match local.to_lowercase().as_str() {
        "destination" => {
            req.destination = Some(value.to_string());
        }
        "id" => {
            req.relay_state = Some(value.to_string());
        }
        "issueinstant" => {
            debug!("Found issueinstant: {}", value.to_string());
            // Date parsing... 2021-07-19T12:06:25Z
            let parsed_datetime = DateTime::parse_from_rfc3339(&value);
            debug!("parsed_datetime: {:?}", parsed_datetime);
            match parsed_datetime {
                Ok(value) => {
                    debug!("Setting issue_instant");
                    let result: DateTime<Utc> = value.into();
                    req.issue_instant = Some(result);
                }
                Err(error) => {
                    eprintln!(
                        "Failed to cast datetime source={:?}, error=\"{}\"",
                        value.to_string(),
                        error
                    );
                }
            };
        }
        "assertionconsumerserviceurl" => {
            req.consumer_service_url = Some(value.to_string());
        }
        "version" => {
            if value.to_string() != "2.0" {
                return Err(AuthnDecodeError::new(format!(
                    "SAML Request where version!=2.0 ({}), this is probably bad.",
                    value.to_string()
                )));
            }
            req.version = value.to_string();
        }
        _ => debug!(
            "Found tokenizer attribute={}, value={}",
            local.to_lowercase().as_str(),
            value.to_string()
        ),
    }
    //eprintln!("after block {:?}", req.issue_instant);
    Ok(req)
}
fn parse_authn_tokenizer_attribute ( local : StrSpan , value : StrSpan , mut req : AuthnRequestParser , ) -> Result < AuthnRequestParser , AuthnDecodeError > { match local . to_lowercase ( ) . as_str ( ) { " " => { req . destination = Some ( value . to_string ( ) ) ; } " " => { req . relay_state = Some ( value . to_string ( ) ) ; } " " => { debug ! ( " " value to_string ( ) ) ; // Date parsing... 2021-07-19T12:06:25Z let parsed_datetime = DateTime :: parse_from_rfc3339 ( & value ) ; debug ! ( " " parsed_datetime ) ; match parsed_datetime { Ok ( value ) => { debug ! ( " " ) ; let result : DateTime < Utc > = value . into ( ) ; req . issue_instant = Some ( result ) ; } Err ( error ) => { eprintln ! ( " \" \" " value to_string ( ) error ) ; } } ; } " " => { req . consumer_service_url = Some ( value . to_string ( ) ) ; } " " => { if value . to_string ( ) != " " { return Err ( AuthnDecodeError :: new ( format ! ( " " value to_string ( ) ) ) ) ; } req . version = value . to_string ( ) ; } _ => debug ! ( " " local to_lowercase ( ) as_str ( ) value to_string ( ) ) , } //eprintln!("after block {:?}", req.issue_instant); Ok ( req ) }
Used inside AuthnRequestParser to help parse the AuthN request
Used inside AuthnRequestParser to help parse the AuthN request
local
StrSpan
value
StrSpan
req
AuthnRequestParser
local
StrSpan
value
StrSpan
req
AuthnRequestParser