/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.audit.AssertionMessages
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.policy.assertion.WsiSamlAssertion
 */
package com.l7tech.server.policy.assertion;

import com.l7tech.gateway.common.audit.AssertionMessages;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.policy.assertion.WsiSamlAssertion;
import com.l7tech.server.policy.assertion.ServerXpathValidationAssertion;
import java.io.InputStream;
import javax.xml.xpath.XPathException;

public class ServerWsiSamlAssertion
extends ServerXpathValidationAssertion<WsiSamlAssertion> {
    private static final String i;
    private static final String[] k;

    public ServerWsiSamlAssertion(WsiSamlAssertion wsiSamlAssertion) {
        super(wsiSamlAssertion);
    }

    @Override
    protected boolean isCheckRequestMessages() {
        return ((WsiSamlAssertion)this.assertion).isCheckRequestMessages();
    }

    @Override
    protected boolean isCheckResponseMessages() {
        return ((WsiSamlAssertion)this.assertion).isCheckResponseMessages();
    }

    @Override
    protected boolean isFailOnNonCompliantRequest() {
        return ((WsiSamlAssertion)this.assertion).isFailOnNonCompliantRequest();
    }

    @Override
    protected boolean isFailOnNonCompliantResponse() {
        return ((WsiSamlAssertion)this.assertion).isFailOnNonCompliantResponse();
    }

    @Override
    protected void onRequestFailure() {
        this.logAndAudit((AuditDetailMessage)AssertionMessages.WSI_SAML_REQUEST_FAIL);
    }

    @Override
    protected void onRequestNonCompliance(String string, String string2) {
        if (((WsiSamlAssertion)this.assertion).isAuditRequestNonCompliance()) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.WSI_SAML_REQUEST_NON_COMPLIANT, string, string2);
        }
    }

    @Override
    protected void onRequestNonSoap() {
        this.logAndAudit((AuditDetailMessage)AssertionMessages.WSI_SAML_REQUEST_NON_SOAP);
    }

    @Override
    protected void onResponseFailure() {
        this.logAndAudit((AuditDetailMessage)AssertionMessages.WSI_SAML_RESPONSE_FAIL);
    }

    @Override
    protected void onResponseNonCompliance(String string, String string2) {
        if (((WsiSamlAssertion)this.assertion).isAuditResponseNonCompliance()) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.WSI_SAML_RESPONSE_NON_COMPLIANT, string, string2);
        }
    }

    @Override
    protected void onResponseNonSoap() {
        this.logAndAudit((AuditDetailMessage)AssertionMessages.WSI_SAML_RESPONSE_NON_SOAP);
    }

    @Override
    protected void onXPathError(XPathException xPathException) {
        this.logAndAudit((AuditDetailMessage)AssertionMessages.WSI_SAML_XPATH_ERROR, null, xPathException);
    }

    @Override
    protected InputStream getRulesResource() {
        ClassLoader classLoader = ServerWsiSamlAssertion.class.getClassLoader();
        return classLoader.getResourceAsStream(k[0]);
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[2];
        int n2 = 0;
        String string = "\u0005YMZ>E7\u0003UHZ!\u00171\u0010SRZ\"\u001d/\u000fUYZ3\u00010\u0003DT\u001c=\u001cl5SR\u00037\u0000\u0014\u0015_s\u0014?\u001e\u0002\u0015EE\u0007&\u001b,\b\u0018R\u0000>\u00170HFR\u001a\"\u00171\u0012_E\u0006J\u0005YMZ>E7\u0003UHZ!\u00171\u0010SRZ\"\u001d/\u000fUYZ3\u00010\u0003DT\u001c=\u001cl5SR\u00037\u0000\u0014\u0015_s\u0014?\u001e\u0002\u0015EE\u0007&\u001b,\b\u0018R\u0000>\u00170HFR\u001a\"\u00171\u0012_E\u0006";
        int n3 = "\u0005YMZ>E7\u0003UHZ!\u00171\u0010SRZ\"\u001d/\u000fUYZ3\u00010\u0003DT\u001c=\u001cl5SR\u00037\u0000\u0014\u0015_s\u0014?\u001e\u0002\u0015EE\u0007&\u001b,\b\u0018R\u0000>\u00170HFR\u001a\"\u00171\u0012_E\u0006J\u0005YMZ>E7\u0003UHZ!\u00171\u0010SRZ\"\u001d/\u000fUYZ3\u00010\u0003DT\u001c=\u001cl5SR\u00037\u0000\u0014\u0015_s\u0014?\u001e\u0002\u0015EE\u0007&\u001b,\b\u0018R\u0000>\u00170HFR\u001a\"\u00171\u0012_E\u0006".length();
        int n4 = 74;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = ServerWsiSamlAssertion.c(9, ServerWsiSamlAssertion.c(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                k = stringArray;
                i = k[1];
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] c(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x4A);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String c(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 111;
                    case 1 -> 63;
                    case 2 -> 41;
                    case 3 -> 124;
                    case 4 -> 91;
                    case 5 -> 123;
                    default -> 74;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

