<commit_before>package org.apereo.cas.support.saml.authentication;

import org.apereo.cas.support.saml.AbstractOpenSamlTests;
import org.apereo.cas.support.saml.config.SamlGoogleAppsConfiguration;
import org.apereo.cas.support.saml.util.GoogleSaml20ObjectBuilder;

import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.junit.Test;
import org.springframework.context.annotation.Import;

import static org.junit.Assert.*;

/**
 * This is {@link GoogleSaml20ObjectBuilderTests}.
 *
 * @author <NAME>
 * @since 6.0.0
 */
@Import(SamlGoogleAppsConfiguration.class)
@Slf4j
public class GoogleSaml20ObjectBuilderTests extends AbstractOpenSamlTests {

    private static final String BASE64_SAML_AUTHN_REQUEST = "<KEY>"
        + <KEY>"
        + <KEY>"
        + "+1oS6UOEO2kIOFsTgQ8x4BU6miz4LfiDVvBwf1vyIYSRRJYdj8f0TSaTWR/i7lKrpdU4pNBOmVTEq3nBYu7o32326wbyNQGv3jxW2Tup6uXjTn021zUarf6xtTF4vPIgQywT"
        + "/BS73KC3Mnzulqf5jOg26WaqmByNoHSnoeUsq86uHy8k3s1/";

    private static final String SAML_AUTHN_REQUEST = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
        + "<samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" ID=\"koppjkmemdcahpgfgcgelhncepikbjcbiiopooif\" Version=\"2.0\" "
        + "IssueInstant=\"2018-12-13T18:32:28Z\" ProtocolBinding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" ProviderName=\"google.com\" IsPassive=\"false\""
        + " AssertionConsumerServiceURL=\"https://www.google.com/a/gtest.miamioh.edu/acs\"><saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">google"
        + ".com</saml:Issuer><samlp:NameIDPolicy AllowCreate=\"true\" Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified\" /></samlp:AuthnRequest>\r\n";

    @Test
    public void decodeNonInflatedSamlAuthnRequest() {
        val builder = new GoogleSaml20ObjectBuilder(this.configBean);
        val decoded = builder.decodeSamlAuthnRequest(BASE64_SAML_AUTHN_REQUEST);
        assertEquals(SAML_AUTHN_REQUEST, decoded);
    }
}
<commit_msg>fix saml tests; ensure props are loaded<commit_after>package org.apereo.cas.support.saml.authentication;

import org.apereo.cas.support.saml.AbstractOpenSamlTests;
import org.apereo.cas.support.saml.config.SamlGoogleAppsConfiguration;
import org.apereo.cas.support.saml.util.GoogleSaml20ObjectBuilder;

import lombok.val;
import org.junit.Test;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;

import static org.junit.Assert.*;

/**
 * This is {@link GoogleSaml20ObjectBuilderTests}.
 *
 * @author <NAME>
 * @since 6.0.0
 */
@Import(SamlGoogleAppsConfiguration.class)
@TestPropertySource(locations = "classpath:/gapps.properties")
public class GoogleSaml20ObjectBuilderTests extends AbstractOpenSamlTests {

    private static final String BASE64_SAML_AUTHN_REQUEST = "<KEY>"
        + <KEY>"
        + <KEY>"
        + <KEY>"
        + <KEY>/";

    private static final String SAML_AUTHN_REQUEST = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
        + "<samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" ID=\"koppjkmemdcahpgfgcgelhncepikbjcbiiopooif\" Version=\"2.0\" "
        + "IssueInstant=\"2018-12-13T18:32:28Z\" ProtocolBinding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" ProviderName=\"google.com\" IsPassive=\"false\""
        + " AssertionConsumerServiceURL=\"https://www.google.com/a/gtest.miamioh.edu/acs\"><saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">google"
        + ".com</saml:Issuer><samlp:NameIDPolicy AllowCreate=\"true\" Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified\" /></samlp:AuthnRequest>\r\n";

    @Test
    public void decodeNonInflatedSamlAuthnRequest() {
        val builder = new GoogleSaml20ObjectBuilder(this.configBean);
        val decoded = builder.decodeSamlAuthnRequest(BASE64_SAML_AUTHN_REQUEST);
        assertEquals(SAML_AUTHN_REQUEST, decoded);
    }
}

{'fraction_non_alphanumeric': 0.14314772438342233, 'fraction_numerical': 0.03178235443681668, 'mean_word_length': 4.9787234042553195, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 2, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, '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': '6446407', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1419, 'n_words': 165}