<commit_before>package org.apereo.cas.support.saml.web.idp.audit;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.commons.lang3.tuple.Pair;
import org.apereo.inspektr.audit.spi.support.ReturnValueAsStringResourceResolver;
import org.aspectj.lang.JoinPoint;
import org.jetbrains.annotations.NotNull;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml.saml2.core.LogoutRequest;

/**
 * This is {@link SamlRequestAuditResourceResolver}.
 *
 * @author <NAME>
 * @since 5.3.0
 */
@Slf4j
public class SamlRequestAuditResourceResolver extends ReturnValueAsStringResourceResolver {
    @Override
    public String[] resolveFrom(final JoinPoint joinPoint, final Object returnValue) {
        if (returnValue instanceof Pair) {
            return getAuditResourceFromSamlRequest((Pair) returnValue);
        }
        return new String[]{};
    }

    private String[] getAuditResourceFromSamlRequest(final Pair result) {<commit_msg>add auditing support to saml2 for responses<commit_after>package org.apereo.cas.support.saml.web.idp.audit;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.commons.lang3.tuple.Pair;
import org.apereo.inspektr.audit.spi.support.ReturnValueAsStringResourceResolver;
import org.aspectj.lang.JoinPoint;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml.saml2.core.LogoutRequest;

/**
 * This is {@link SamlRequestAuditResourceResolver}.
 *
 * @author <NAME>
 * @since 5.3.0
 */
@Slf4j
public class SamlRequestAuditResourceResolver extends ReturnValueAsStringResourceResolver {
    @Override
    public String[] resolveFrom(final JoinPoint joinPoint, final Object returnValue) {
        if (returnValue instanceof Pair) {
            return getAuditResourceFromSamlRequest((Pair) returnValue);
        }
        return new String[]{};
    }

    private String[] getAuditResourceFromSamlRequest(final Pair result) {
{'fraction_non_alphanumeric': 0.10109289617486339, 'fraction_numerical': 0.010473588342440802, 'mean_word_length': 4.843085106382978, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7327793', 'n_tokens_mistral': 698, 'n_tokens_neox': 684, 'n_words': 124}