/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.http.HttpConstants
 *  com.l7tech.common.io.CertUtils
 *  com.l7tech.common.password.PasswordHasher
 *  com.l7tech.gateway.common.LicenseException
 *  com.l7tech.gateway.common.LicenseManager
 *  com.l7tech.gateway.common.service.PublishedService
 *  com.l7tech.gateway.common.transport.SsgConnector
 *  com.l7tech.gateway.common.transport.SsgConnector$Endpoint
 *  com.l7tech.identity.AuthenticationException
 *  com.l7tech.identity.BadCredentialsException
 *  com.l7tech.identity.FailAttemptsExceededException
 *  com.l7tech.identity.IdentityProvider
 *  com.l7tech.identity.IdentityProviderType
 *  com.l7tech.identity.IssuedCertNotPresentedException
 *  com.l7tech.identity.MissingCredentialsException
 *  com.l7tech.identity.User
 *  com.l7tech.identity.UserBean
 *  com.l7tech.identity.cert.ClientCertManager
 *  com.l7tech.identity.ldap.LdapIdentityProviderConfig
 *  com.l7tech.identity.ldap.LdapIdentityProviderConfig$UserCertificateUseType
 *  com.l7tech.identity.ldap.LdapUser
 *  com.l7tech.objectmodel.EntityType
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.GuidBasedEntityManager
 *  com.l7tech.policy.IncludeAssertionDereferenceTranslator
 *  com.l7tech.policy.Policy
 *  com.l7tech.policy.assertion.Assertion
 *  com.l7tech.policy.assertion.AssertionTranslator
 *  com.l7tech.policy.assertion.CustomAssertionHolder
 *  com.l7tech.policy.assertion.Include
 *  com.l7tech.policy.assertion.PolicyAssertionException
 *  com.l7tech.policy.assertion.composite.CompositeAssertion
 *  com.l7tech.policy.assertion.credential.LoginCredentials
 *  com.l7tech.policy.assertion.credential.http.HttpBasic
 *  com.l7tech.policy.assertion.identity.IdentityAssertion
 *  com.l7tech.policy.wsp.WspReader
 *  com.l7tech.policy.wsp.WspWriter
 *  com.l7tech.security.token.SecurityToken
 *  com.l7tech.security.token.http.TlsClientCertToken
 *  com.l7tech.util.CausedIOException
 *  com.l7tech.util.Charsets
 *  com.l7tech.util.Config
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.Functions
 *  com.l7tech.util.Functions$Unary
 *  com.l7tech.util.GoidUpgradeMapper
 *  jakarta.servlet.ServletConfig
 *  jakarta.servlet.ServletContext
 *  jakarta.servlet.ServletException
 *  jakarta.servlet.ServletRequest
 *  jakarta.servlet.http.HttpServlet
 *  jakarta.servlet.http.HttpServletRequest
 *  jakarta.servlet.http.HttpServletResponse
 *  org.springframework.context.ApplicationContext
 *  org.springframework.web.context.WebApplicationContext
 *  org.springframework.web.context.support.WebApplicationContextUtils
 */
package com.l7tech.server;

import com.l7tech.common.http.HttpConstants;
import com.l7tech.common.io.CertUtils;
import com.l7tech.common.password.PasswordHasher;
import com.l7tech.gateway.common.LicenseException;
import com.l7tech.gateway.common.LicenseManager;
import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.gateway.common.transport.SsgConnector;
import com.l7tech.identity.AuthenticationException;
import com.l7tech.identity.BadCredentialsException;
import com.l7tech.identity.FailAttemptsExceededException;
import com.l7tech.identity.IdentityProvider;
import com.l7tech.identity.IdentityProviderType;
import com.l7tech.identity.IssuedCertNotPresentedException;
import com.l7tech.identity.MissingCredentialsException;
import com.l7tech.identity.User;
import com.l7tech.identity.UserBean;
import com.l7tech.identity.cert.ClientCertManager;
import com.l7tech.identity.ldap.LdapIdentityProviderConfig;
import com.l7tech.identity.ldap.LdapUser;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.GuidBasedEntityManager;
import com.l7tech.policy.IncludeAssertionDereferenceTranslator;
import com.l7tech.policy.Policy;
import com.l7tech.policy.assertion.Assertion;
import com.l7tech.policy.assertion.AssertionTranslator;
import com.l7tech.policy.assertion.CustomAssertionHolder;
import com.l7tech.policy.assertion.Include;
import com.l7tech.policy.assertion.PolicyAssertionException;
import com.l7tech.policy.assertion.composite.CompositeAssertion;
import com.l7tech.policy.assertion.credential.LoginCredentials;
import com.l7tech.policy.assertion.credential.http.HttpBasic;
import com.l7tech.policy.assertion.identity.IdentityAssertion;
import com.l7tech.policy.wsp.WspReader;
import com.l7tech.policy.wsp.WspWriter;
import com.l7tech.security.token.SecurityToken;
import com.l7tech.security.token.http.TlsClientCertToken;
import com.l7tech.server.admin.AdminSessionManager;
import com.l7tech.server.f;
import com.l7tech.server.identity.AuthenticatingIdentityProvider;
import com.l7tech.server.identity.AuthenticationResult;
import com.l7tech.server.identity.IdentityProviderFactory;
import com.l7tech.server.policy.PolicyManager;
import com.l7tech.server.policy.assertion.credential.http.ServerHttpBasic;
import com.l7tech.server.service.ServiceCache;
import com.l7tech.server.transport.ListenerException;
import com.l7tech.server.transport.http.HttpTransportModule;
import com.l7tech.server.util.ServletUtils;
import com.l7tech.util.CausedIOException;
import com.l7tech.util.Charsets;
import com.l7tech.util.Config;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.Functions;
import com.l7tech.util.GoidUpgradeMapper;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public abstract class AuthenticatableHttpServlet
extends HttpServlet {
    protected final Logger logger = Logger.getLogger(((Object)((Object)this)).getClass().getName());
    private static final boolean checkCertificatePresent;
    private WebApplicationContext applicationContext;
    protected Config config;
    protected PolicyManager policyManager;
    protected ServiceCache serviceCache;
    protected ClientCertManager clientCertManager;
    protected WspReader wspReader;
    protected IdentityProviderFactory identityProviderFactory;
    protected LicenseManager licenseManager;
    protected PasswordHasher passwordHasher;
    protected AdminSessionManager adminSessionManager;
    static final long serialVersionUID = -7855579329841584822L;
    private static final String[] a;

    public void init(ServletConfig servletConfig) throws ServletException {
        try {
            super.init(servletConfig);
            this.applicationContext = WebApplicationContextUtils.getWebApplicationContext((ServletContext)this.getServletContext());
            if (this.applicationContext == null) {
                throw new ServletException(a[48]);
            }
        }
        catch (ServletException servletException) {
            throw AuthenticatableHttpServlet.c((Exception)((Object)servletException));
        }
        String[] stringArray = a;
        this.config = this.getBean(stringArray[6], Config.class);
        this.clientCertManager = this.getBean(stringArray[9], ClientCertManager.class);
        this.identityProviderFactory = this.getBean(stringArray[52], IdentityProviderFactory.class);
        this.licenseManager = this.getBean(stringArray[47], LicenseManager.class);
        this.serviceCache = this.getBean(stringArray[27], ServiceCache.class);
        this.policyManager = this.getBean(stringArray[19], PolicyManager.class);
        this.wspReader = this.getBean(stringArray[21], WspReader.class);
        this.passwordHasher = this.getBean(stringArray[18], PasswordHasher.class);
        this.adminSessionManager = this.getBean(stringArray[5], AdminSessionManager.class);
    }

    protected Object getBean(String string) throws ServletException {
        return this.getBean(string, null);
    }

    protected <T> T getBean(String string, Class<T> clazz) throws ServletException {
        Object object;
        block8: {
            object = this.applicationContext.getBean(string, clazz);
            try {
                if (object == null) {
                    throw new ServletException(a[38] + string);
                }
            }
            catch (ServletException servletException) {
                throw AuthenticatableHttpServlet.c((Exception)((Object)servletException));
            }
            try {
                try {
                    if (clazz != null && !clazz.isAssignableFrom(object.getClass())) {
                    }
                    break block8;
                }
                catch (ServletException servletException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)servletException));
                }
                throw new ServletException(a[30] + string + a[49] + String.valueOf(object.getClass()));
            }
            catch (ServletException servletException) {
                throw AuthenticatableHttpServlet.c((Exception)((Object)servletException));
            }
        }
        return (T)object;
    }

    protected abstract String getFeature();

    protected abstract SsgConnector.Endpoint getRequiredEndpoint();

    protected void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
        try {
            SsgConnector ssgConnector = HttpTransportModule.getConnector((ServletRequest)httpServletRequest);
            HttpTransportModule.addHstsResponseHeaderIfRequired(httpServletRequest, httpServletResponse, ssgConnector, this.config);
            SsgConnector.Endpoint endpoint = this.getRequiredEndpoint();
            try {
                if (endpoint != null) {
                    HttpTransportModule.requireEndpoint(ssgConnector, endpoint);
                }
            }
            catch (ListenerException listenerException) {
                throw AuthenticatableHttpServlet.c(listenerException);
            }
        }
        catch (ListenerException listenerException) {
            httpServletResponse.sendError(502, a[12]);
            return;
        }
        super.service(httpServletRequest, httpServletResponse);
    }

    protected AuthenticationResult[] authenticateRequestBasic(HttpServletRequest httpServletRequest) throws BadCredentialsException, MissingCredentialsException, IssuedCertNotPresentedException, LicenseException, ListenerException {
        return this.authenticateRequestBasic(httpServletRequest, false);
    }

    protected AuthenticationResult[] authenticateRequestBasic(HttpServletRequest httpServletRequest, boolean bl2) throws BadCredentialsException, MissingCredentialsException, IssuedCertNotPresentedException, LicenseException, ListenerException {
        this.licenseManager.requireFeature(this.getFeature());
        try {
            AuthenticationResult[] authenticationResultArray;
            block7: {
                AhsAuthResult ahsAuthResult = this.authenticateRequestAgainstAllIdProviders(httpServletRequest, bl2);
                authenticationResultArray = ahsAuthResult.getAuthResults();
                try {
                    if (authenticationResultArray != null && authenticationResultArray.length >= 1) break block7;
                }
                catch (FindException findException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
                }
                String[] stringArray = a;
                String string = stringArray[32];
                try {
                    this.logger.warning(string);
                    if (ahsAuthResult.isSawCredentials()) {
                        throw new BadCredentialsException(string);
                    }
                }
                catch (FindException findException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
                }
                throw new MissingCredentialsException();
            }
            return authenticationResultArray;
        }
        catch (FindException findException) {
            this.logger.log(Level.SEVERE, a[24], findException);
            return new AuthenticationResult[0];
        }
    }

    protected void doHttpBasicChallenge(HttpServletResponse httpServletResponse) throws IOException {
        httpServletResponse.setStatus(401);
        String[] stringArray = a;
        httpServletResponse.setHeader(HttpConstants.HEADER_WWW_AUTHENTICATE, stringArray[28]);
        httpServletResponse.setContentType(stringArray[13]);
        httpServletResponse.getWriter().println(stringArray[43]);
    }

    /*
     * Loose catch block
     */
    private AhsAuthResult authenticateRequestAgainstAllIdProviders(HttpServletRequest httpServletRequest, boolean bl2) throws FindException, IssuedCertNotPresentedException {
        boolean bl3;
        ArrayList<AuthenticationResult> arrayList;
        block38: {
            LoginCredentials loginCredentials;
            Collection<IdentityProvider> collection;
            block32: {
                boolean bl4;
                arrayList = new ArrayList<AuthenticationResult>();
                collection = this.identityProviderFactory.findAllIdentityProviders();
                loginCredentials = this.findCredentialsBasic(httpServletRequest);
                try {
                    bl4 = loginCredentials != null;
                }
                catch (FailAttemptsExceededException failAttemptsExceededException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                }
                bl3 = bl4;
                try {
                    if (loginCredentials == null) {
                        return new AhsAuthResult(bl3, new AuthenticationResult[0]);
                    }
                }
                catch (FailAttemptsExceededException failAttemptsExceededException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                }
                if (httpServletRequest.isSecure()) break block32;
                try {
                    block39: {
                        if (this.isCleartextAllowed()) break block32;
                        break block39;
                        catch (FailAttemptsExceededException failAttemptsExceededException) {
                            throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                        }
                    }
                    this.logger.info(a[40]);
                    return new AhsAuthResult(bl3, new AuthenticationResult[0]);
                }
                catch (FailAttemptsExceededException failAttemptsExceededException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                }
            }
            boolean bl5 = false;
            for (IdentityProvider identityProvider : collection) {
                block34: {
                    String[] stringArray;
                    try {
                        block37: {
                            Certificate certificate;
                            X509Certificate x509Certificate;
                            AuthenticationResult authenticationResult;
                            block36: {
                                Certificate certificate2;
                                User user;
                                block35: {
                                    block33: {
                                        authenticationResult = bl2 ? this.adminSessionManager.authenticate(loginCredentials, false) : ((AuthenticatingIdentityProvider)identityProvider).authenticate(loginCredentials);
                                        try {
                                            if (authenticationResult == null && !bl2) {
                                                continue;
                                            }
                                        }
                                        catch (FailAttemptsExceededException failAttemptsExceededException) {
                                            throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                                        }
                                        if (authenticationResult == null) break;
                                        user = authenticationResult.getUser();
                                        identityProvider = this.getProviderForUser(authenticationResult.getUser(), collection);
                                        try {
                                            this.logger.fine(a[50] + loginCredentials.getLogin() + a[4] + identityProvider.getConfig().getName());
                                            if (httpServletRequest.isSecure()) break block33;
                                            this.logger.info(a[44]);
                                            arrayList.add(authenticationResult);
                                            break block34;
                                        }
                                        catch (FailAttemptsExceededException failAttemptsExceededException) {
                                            throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                                        }
                                    }
                                    try {
                                        if (checkCertificatePresent) break block35;
                                        this.logger.finest(a[17]);
                                        arrayList.add(authenticationResult);
                                        break block34;
                                    }
                                    catch (FailAttemptsExceededException failAttemptsExceededException) {
                                        throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                                    }
                                }
                                x509Certificate = ServletUtils.getRequestCert(httpServletRequest);
                                try {
                                    certificate2 = this.isLdapCerts(identityProvider) ? ((LdapUser)user).getCertificate() : this.clientCertManager.getUserCert(user);
                                }
                                catch (FailAttemptsExceededException failAttemptsExceededException) {
                                    throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                                }
                                certificate = certificate2;
                                try {
                                    if (certificate != null) break block36;
                                    this.logger.finest(a[1] + user.getLogin() + a[2]);
                                    arrayList.add(authenticationResult);
                                    break block34;
                                }
                                catch (FailAttemptsExceededException failAttemptsExceededException) {
                                    throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                                }
                            }
                            if (x509Certificate == null) {
                                stringArray = a;
                                this.logger.info(stringArray[25] + loginCredentials.getLogin() + stringArray[35]);
                                bl5 = true;
                            }
                            if (!(certificate instanceof X509Certificate)) {
                                stringArray = a;
                                this.logger.warning(stringArray[3]);
                                continue;
                            }
                            Certificate certificate3 = certificate;
                            try {
                                if (!CertUtils.certsAreEqual((X509Certificate)x509Certificate, (X509Certificate)certificate3)) break block37;
                                this.logger.finest(a[10]);
                                arrayList.add(new AuthenticationResult(authenticationResult.getUser(), (SecurityToken)new TlsClientCertToken(certificate3), (X509Certificate)certificate3, this.clientCertManager.isCertPossiblyStale(certificate3)));
                                break block34;
                            }
                            catch (FailAttemptsExceededException failAttemptsExceededException) {
                                throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                            }
                        }
                        stringArray = a;
                        this.logger.warning(stringArray[45]);
                    }
                    catch (FailAttemptsExceededException failAttemptsExceededException) {
                        stringArray = a;
                        this.logger.warning(stringArray[34] + loginCredentials.getLogin() + "'");
                    }
                    catch (Exception exception) {
                        stringArray = a;
                        this.logger.fine(stringArray[20] + loginCredentials.getLogin() + stringArray[31] + identityProvider.getConfig().getName());
                    }
                }
                try {
                    if (!bl2) continue;
                    break;
                }
                catch (FailAttemptsExceededException failAttemptsExceededException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
                }
            }
            try {
                if (!arrayList.isEmpty() || !bl5) break block38;
            }
            catch (FailAttemptsExceededException failAttemptsExceededException) {
                throw AuthenticatableHttpServlet.c((Exception)((Object)failAttemptsExceededException));
            }
            String string = a[46];
            this.logger.warning(string);
            throw new IssuedCertNotPresentedException(string);
        }
        return new AhsAuthResult(bl3, arrayList.toArray(new AuthenticationResult[arrayList.size()]));
    }

    private IdentityProvider getProviderForUser(User user, Collection<IdentityProvider> collection) throws AuthenticationException {
        IdentityProvider identityProvider = null;
        if (user != null) {
            identityProvider = (IdentityProvider)Functions.grepFirst(collection, this.providerOidPredicate(user.getProviderId()));
        }
        try {
            if (identityProvider == null) {
                throw new AuthenticationException(a[39]);
            }
        }
        catch (AuthenticationException authenticationException) {
            throw AuthenticatableHttpServlet.c((Exception)((Object)authenticationException));
        }
        return identityProvider;
    }

    private Functions.Unary<Boolean, IdentityProvider> providerOidPredicate(Goid goid) {
        return new f(this, goid);
    }

    private boolean isLdapCerts(IdentityProvider identityProvider) {
        boolean bl2;
        block5: {
            block4: {
                try {
                    try {
                        if (!(identityProvider.getConfig() instanceof LdapIdentityProviderConfig) || ((LdapIdentityProviderConfig)identityProvider.getConfig()).getUserCertificateUseType() == LdapIdentityProviderConfig.UserCertificateUseType.NONE) break block4;
                    }
                    catch (RuntimeException runtimeException) {
                        throw AuthenticatableHttpServlet.c(runtimeException);
                    }
                    bl2 = true;
                    break block5;
                }
                catch (RuntimeException runtimeException) {
                    throw AuthenticatableHttpServlet.c(runtimeException);
                }
            }
            bl2 = false;
        }
        return bl2;
    }

    protected boolean isCleartextAllowed() {
        return false;
    }

    protected AuthenticationResult[] authenticateRequestBasic(HttpServletRequest httpServletRequest, PublishedService publishedService) throws IOException, BadCredentialsException, MissingCredentialsException, IssuedCertNotPresentedException, LicenseException, ListenerException {
        Object object;
        boolean bl2;
        AhsAuthResult ahsAuthResult;
        block12: {
            this.licenseManager.requireFeature(this.getFeature());
            this.requireEndpoint(httpServletRequest);
            try {
                ahsAuthResult = this.authenticateRequestAgainstAllIdProviders(httpServletRequest, false);
                bl2 = ahsAuthResult.isSawCredentials();
                object = ahsAuthResult.getAuthResults();
                try {
                    if (object == null || ((AuthenticationResult[])object).length <= 0) break block12;
                }
                catch (FindException findException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
                }
                return object;
            }
            catch (FindException findException) {
                String[] stringArray = a;
                this.logger.log(Level.SEVERE, stringArray[42], findException);
                return new AuthenticationResult[0];
            }
        }
        ahsAuthResult = this.findCredentialsBasic(httpServletRequest);
        try {
            if (ahsAuthResult == null) {
                return new AuthenticationResult[0];
            }
        }
        catch (FindException findException) {
            throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
        }
        if (publishedService != null) {
            object = publishedService.getPolicy().getAssertion().preorderIterator();
            while (object.hasNext()) {
                CustomAssertionHolder customAssertionHolder;
                Assertion assertion = (Assertion)object.next();
                if (!(assertion instanceof CustomAssertionHolder) || !(customAssertionHolder = (CustomAssertionHolder)assertion).isCustomCredentialSource()) continue;
                UserBean userBean = new UserBean();
                userBean.setProviderId(new Goid(0L, Long.MAX_VALUE));
                userBean.setLogin(ahsAuthResult.getLogin());
                String string = this.passwordHasher.hashPassword(new String(ahsAuthResult.getCredentials()).getBytes(Charsets.UTF8));
                userBean.setHashedPassword(string);
                return new AuthenticationResult[]{new AuthenticationResult((User)userBean, ahsAuthResult.getSecurityTokens())};
            }
        }
        object = a[16];
        try {
            this.logger.warning((String)object);
            if (bl2) {
                throw new BadCredentialsException((String)object);
            }
        }
        catch (FindException findException) {
            throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
        }
        throw new MissingCredentialsException();
    }

    private void requireEndpoint(HttpServletRequest httpServletRequest) throws ListenerException {
        SsgConnector.Endpoint endpoint = this.getRequiredEndpoint();
        try {
            if (endpoint != null) {
                HttpTransportModule.requireEndpoint((ServletRequest)httpServletRequest, endpoint);
            }
        }
        catch (ListenerException listenerException) {
            throw AuthenticatableHttpServlet.c(listenerException);
        }
    }

    /*
     * Unable to fully structure code
     */
    protected LoginCredentials findCredentialsBasic(HttpServletRequest var1_1) {
        block9: {
            var6_2 = AuthenticatableHttpServlet.a;
            var2_3 = var1_1.getHeader(var6_2[22]);
            if (var2_3 == null) ** GOTO lbl10
            try {
                block10: {
                    if (var2_3.length() >= 1) break block9;
                    break block10;
                    catch (IOException v0) {
                        throw AuthenticatableHttpServlet.c(v0);
                    }
                }
                this.logger.warning(AuthenticatableHttpServlet.a[23]);
                return null;
            }
            catch (IOException v1) {
                throw AuthenticatableHttpServlet.c(v1);
            }
        }
        var3_4 = new ServerHttpBasic(new HttpBasic());
        try {
            var4_5 = var3_4.findCredentials(var2_3);
            try {
                if (var4_5 == null) {
                    this.logger.warning(AuthenticatableHttpServlet.a[7]);
                }
            }
            catch (IOException v2) {
                throw AuthenticatableHttpServlet.c(v2);
            }
            return var4_5;
        }
        catch (IOException var5_6) {
            this.logger.log(Level.SEVERE, AuthenticatableHttpServlet.a[37], var5_6);
            return null;
        }
    }

    protected String getIdentityProviderName(Goid goid) {
        String[] stringArray = a;
        String string = stringArray[26];
        try {
            IdentityProvider identityProvider = this.identityProviderFactory.getProvider(goid);
            if (identityProvider != null) {
                string = identityProvider.getConfig().getName();
            }
        }
        catch (FindException findException) {
            this.logger.log(Level.WARNING, a[33], findException);
        }
        return string;
    }

    private Assertion inlineIncludes(Assertion assertion) throws PolicyAssertionException {
        Assertion assertion2;
        if (Assertion.contains((Assertion)assertion, Include.class)) {
            HashSet hashSet = new HashSet();
            IncludeAssertionDereferenceTranslator includeAssertionDereferenceTranslator = new IncludeAssertionDereferenceTranslator((GuidBasedEntityManager)this.policyManager, hashSet, false, false);
            try {
                assertion2 = Assertion.translate((Assertion)WspReader.getDefault().parsePermissively(WspWriter.getPolicyXml((Assertion)assertion), WspReader.OMIT_DISABLED), (AssertionTranslator)includeAssertionDereferenceTranslator);
            }
            catch (IOException iOException) {
                throw new RuntimeException(iOException);
            }
        } else {
            assertion2 = assertion;
        }
        return assertion2;
    }

    protected Assertion parsePolicy(String string) throws IOException {
        Assertion assertion;
        try {
            assertion = this.inlineIncludes(this.wspReader.parsePermissively(string, WspReader.OMIT_DISABLED));
        }
        catch (PolicyAssertionException policyAssertionException) {
            throw new CausedIOException(a[14], (Throwable)policyAssertionException);
        }
        return assertion;
    }

    protected boolean policyAllowAnonymous(Policy policy) throws IOException {
        Assertion assertion;
        block20: {
            assertion = this.parsePolicy(policy.getXml());
            try {
                if (assertion == null) {
                    return true;
                }
            }
            catch (FindException findException) {
                throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
            }
            Iterator iterator = assertion.preorderIterator();
            boolean bl2 = true;
            while (iterator.hasNext()) {
                CustomAssertionHolder customAssertionHolder;
                Assertion assertion2 = (Assertion)iterator.next();
                try {
                    if (!assertion2.isEnabled()) {
                        this.logger.fine(a[8]);
                        continue;
                    }
                }
                catch (FindException findException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
                }
                if (assertion2 instanceof CustomAssertionHolder) {
                    customAssertionHolder = (CustomAssertionHolder)assertion2;
                    try {
                        if (!customAssertionHolder.isCustomCredentialSource()) continue;
                        return true;
                    }
                    catch (FindException findException) {
                        throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
                    }
                }
                if (!(assertion2 instanceof IdentityAssertion)) continue;
                customAssertionHolder = (IdentityAssertion)assertion2;
                String[] stringArray = a;
                String string = stringArray[11];
                try {
                    IdentityProvider identityProvider = this.identityProviderFactory.getProvider(customAssertionHolder.getIdentityProviderOid());
                    if (identityProvider == null) {
                        this.logger.warning(stringArray[29]);
                        return false;
                    }
                    if (identityProvider.getConfig().type() == IdentityProviderType.FEDERATED) continue;
                    bl2 = false;
                }
                catch (FindException findException) {
                    stringArray = a;
                    this.logger.warning(stringArray[29]);
                    return false;
                }
            }
            try {
                try {
                    if (!bl2 || !this.isAllowAnonymousPolicyIfAllIdentitiesFederated()) break block20;
                }
                catch (FindException findException) {
                    throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
                }
                this.logger.info(a[15]);
                return true;
            }
            catch (FindException findException) {
                throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
            }
        }
        try {
            if (this.findCredentialAssertion(assertion) != null) {
                this.logger.info(a[41]);
                return false;
            }
        }
        catch (FindException findException) {
            throw AuthenticatableHttpServlet.c((Exception)((Object)findException));
        }
        this.logger.info(a[51]);
        return true;
    }

    protected boolean isAllowAnonymousPolicyIfAllIdentitiesFederated() {
        return this.config.getBooleanProperty(a[0], false);
    }

    private Assertion findCredentialAssertion(Assertion assertion) {
        block10: {
            block9: {
                try {
                    try {
                        if (!assertion.isEnabled() || !assertion.isCredentialSource()) break block9;
                    }
                    catch (RuntimeException runtimeException) {
                        throw AuthenticatableHttpServlet.c(runtimeException);
                    }
                    return assertion;
                }
                catch (RuntimeException runtimeException) {
                    throw AuthenticatableHttpServlet.c(runtimeException);
                }
            }
            try {
                if (!assertion.isEnabled() || !(assertion instanceof CompositeAssertion)) break block10;
            }
            catch (RuntimeException runtimeException) {
                throw AuthenticatableHttpServlet.c(runtimeException);
            }
            CompositeAssertion compositeAssertion = (CompositeAssertion)assertion;
            for (Assertion assertion2 : compositeAssertion.getChildren()) {
                Assertion assertion3 = this.findCredentialAssertion(assertion2);
                try {
                    if (assertion3 == null) continue;
                    return assertion3;
                }
                catch (RuntimeException runtimeException) {
                    throw AuthenticatableHttpServlet.c(runtimeException);
                }
            }
        }
        return null;
    }

    protected ApplicationContext getApplicationContext() {
        return this.applicationContext;
    }

    protected PublishedService resolveService(Goid goid) {
        return this.serviceCache.getCachedService(goid);
    }

    protected PublishedService resolveService(Long l2) {
        return this.serviceCache.getCachedService(GoidUpgradeMapper.mapOid((EntityType)EntityType.SERVICE, (Long)l2));
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[53];
                var3_1 = 0;
                var2_2 = "*\f\tA^h\rw\b\u0015XYM\r=\f\tVCn\f\t\u0006\u0017^Tb\r*\u0005\f\u001a\u001eE\u0017Zy\r\u0014RD+\u00066\u001d[_V}\ry\b[TRy\u001cy\u0000\u0015\u0017Sj\u001c8\u000b\u001aDR'H;\u001c\u000f\u0017V~\u001c1\f\u0015C^h\t-\f\u001f\u0017D~\u000b:\f\bDQ~\u00045\u0010[@^\u007f\u0000y!/cg+*8\u001a\u0012T\u0017d\u001e<\u001b[ddG$\u001a\u0005\u0012RY\u007fH:\f\tC\u0017b\u0006y\r\u001aCVi\t*\f[^D+\u00066\u001d[o\u0019>X`\u0017y\u0006\u0015\u0017^o\r7\u001d\u0012CN+\u0018+\u0006\r^Sn\u001acI\u00138\r\u0016^YX\r*\u001a\u0012XYF\t7\b\u001cRE\f*\f\tARy+6\u0007\u001d^P\u0015\u0017\u0006[TEn\f<\u0007\u000f^Vg\u001by\u000f\u0014BYoF(\u0018\u001a\bRE\u007f\u00016\u0007[^D+\f0\u001a\u001aU[n\fuI\u0012PYd\u001a<I\u001aDDn\u001a-\u0000\u0014Y\u0019\u0011:\u0005\u0012RY\u007f+<\u001b\u000fzVe\t>\f\t/\u000f\b\u0017^S+\u000b5\u0000\u001eYC+\u000b<\u001b\u000f\u0017Gy\r*\f\u0015CRoH8\u001a[GVy\u001cy\u0006\u001d\u0017En\u0019,\f\bC\u00190\t\u0006\u0017^TrH+\f\u001dRExH-\u0006[V\u0017e\u00077\f\u0003^D\u007f\r7\u001d[^Sn\u0006-\u0000\u000fN\u0017{\u001a6\u001f\u0012SRy \n\f\tA^h\ry\u001c\u0015VAj\u00015\b\u0019[R+\u00077I\u000f_^xH)\u0006\tC\u0019-\f\u0003C\u0018{\u00048\u0000\u0015\f\u0017h\u00008\u001b\bRC6\u001d-\u000fV\u000f\f\t\u0006\u0017^TrH<\u001b\tXEF\u0018\u0005\u0017\u0017~o\r7\u001d\u0012CNJ\u001b*\f\tC^d\u0006*I\u000bX^e\u001cy\u001d\u0014\u0017V+.<\r\u001eEV\u007f\r=I2sg%H\r\u001b\u001eVCb\u0006>I\u001aD\u0017j\u00066\u0007\u0002ZX~\u001bQ\u001a\u001b\u001eSD+\f6I\u0015XC+\t,\u001d\u0013RY\u007f\u0001:\b\u000fR\u0017j\u000f8\u0000\u0015DC+\t7\u0010[ERl\u0001*\u001d\u001eERoH0\r[GEd\u001e0\r\u001eE\u0017d\u001ay\n\u000eDCd\u0005y\b\bDRy\u001c0\u0006\u0015\u0019\u001e\u001a\f\tC^m\u0001:\b\u000fR\u0017h\u0000<\n\u0010\u0017^xH=\u0000\bVUg\r=G\u000e)\b\bD@d\u001a=!\u001aD_n\u001a\r)\u0006\u0017^Tr%8\u0007\u001aPRy\u001f\u0018\u001c\u000f_Re\u001c0\n\u001aC^d\u0006y\u000f\u001a^[n\fy\u000f\u0014E\u0017~\u001b<\u001b[\t.\u001a\u000beRj\f<\u001b\r\u0018\u001c\u000f_Xy\u0001#\b\u000f^Xe\u001e\u0017\u0006[VB\u007f\u00006\u001b\u0012MV\u007f\u00016\u0007[_Rj\f<\u001b[QX~\u0006=G\u001f\u001c\u0011\u0018RG\u007f\u00016\u0007[PR\u007f\u001c0\u0007\u001c\u0017^oH)\u001b\u0014A^o\r+\u001aU\u0005\f\u001a\u001eE\u0017\u0007\f\u0007\u0010YX|\u0006\f*\f\tA^h\r\u001a\b\u0018_R\u001d\u001b\b\b^T+\u001a<\b\u0017Z\n)$n:(puj\u001b0\n)RVg\u0005{0\t\u0006\u0017^TrH+\f\u001dRExH-\u0006[V\u0017e\u00077\f\u0003^D\u007f\r7\u001d[^Sn\u0006-\u0000\u000fN\u0017{\u001a6\u001f\u0012SRy\u001b\u001a\u0006\u0015Q^l\u001d+\b\u000f^XeH<\u001b\tXE0H;\f\u001aY\u0017,\u0017y\u0006\u0015\u0017^o\r7\u001d\u0012CN+\u0018+\u0006\r^Sn\u001acI=\u001a\u001b\u001eSD+\f6I\u0015XC+\t,\u001d\u0013RY\u007f\u0001:\b\u000fR\u0017j\u000f8\u0000\u0015DC+\t7\u0010[ERl\u0001*\u001d\u001eERoH0\r[GEd\u001e0\r\u001eE\u0019 \u001c\u001b\tXE+\u000e0\u0007\u001f^YlH0\r\u001eYCb\u001c I\u000bEX}\u0001=\f\t\u0019:\u0014\b\u0003\u0019\u0017e\u001d4\u000b\u001eE\u0017d\u000ey\u000f\u001a^[n\fy\b\u000fCRf\u0018-\u001a[_VxH;\f\u001eY\u0017y\r8\n\u0013RS+\u000e6\u001b[BDn\u001ayNry\u0001\u001aD\u0017}\t5\u0000\u001f\u0017Uj\u001b0\n[TEn\f<\u0007\u000f^Vg\u001by\u000b\u000eC\u0017b\u001by\u001b\u001eQBx\r=I\u001aBCc\r7\u001d\u0012TV\u007f\u00016\u0007[URh\t,\u001a\u001e\u0017_nH=\u0000\u001f\u0017Yd\u001cy\u0019\tXAnH)\u0006\bDRx\u001b0\u0006\u0015\u0017XmH1\u0000\b\u0017Tg\u0001<\u0007\u000f\u0017Tn\u001a-G2:\u0006\u0016\u0019[<\u001c<\n\u0013\u0019Dn\u001a/\f\t\u0019Dn\u001a/\u0000\u0018RD%\u000b1\f\u0018\\tn\u001a-\u0000\u001d^Tj\u001c<9\tRDn\u0006- \u001c\u0011\u0018RG\u007f\u00016\u0007[[Xd\u00030\u0007\u001c\u0017Qd\u001ay\f\u0003TR{\u001c0\u0006\u0015\u0019#\u001a\u0006\u0015Q^l\u001d+\b\u000f^XeH<\u001b\tXE0H:\u0006\u000e[S+\u00066\u001d[PR\u007fH\u001b\t\u001b\u0014A^o\r+I\u0015XC+\u000e6\u001c\u0015S\u0017m\u0007+I\u000eDRy4\u0011=/g\u0017I\t*\u0000\u0018\u0017V~\u001c1\f\u0015C^h\t-\u0000\u0014Y\u0017b\u001by\u0007\u0014C\u0017j\u00045\u0006\fRS+\u001f0\u001d\u0013XB\u007fH\n:7)\t\u0006\u0017^TrH=\u0006\u001eD\u0017e\u0007-I\u001a[[d\u001fy\b\u0015XYr\u00056\u001c\b\u0017En\u0019,\f\bCD%\u0014\u001c\u001b\tXE+\u000f<\u001d\u000f^YlH,\u001a\u001eED%\u0018\u0018\u001c\u000f_Re\u001c0\n\u001aC^d\u0006y;\u001eFBb\u001a<\rU)\u0011=/g\u0017I\t*\u0000\u0018\u0017^xH;\f\u0012YP+\u0018<\u001b\u0016^C\u007f\r=I\f^Cc\u0007,\u001d[ddGW-\u0001\u001e\u0017V~\u001c1\f\u0015C^h\t-\f\u001f\u0017Bx\r+I\u0013VD+\ty\u001f\u001a[^oH:\f\tC\u0017i\u001d-I\u0013R\u0017{\u001a<\u001a\u001eYCn\fy\b[S^m\u000e<\u001b\u001eYCh\r+\u001d[CX+\u001c1\f[DRy\u001e5\f\u000fg\u001b\b\b^T+\u000b+\f\u001fRY\u007f\u00018\u0005\b\u0017Vy\ry\u001f\u001a[^oH;\u001c\u000f\u0017Cc\ry\n\u0017^Re\u001cy\r\u0012S\u0017e\u0007-I\u000bERx\r7\u001d[_^xH:\u0005\u0012RY\u007fH:\f\tC\u0017j\u001by\u0019\u001aEC+\u0007?I\u000f_R+\u001b*\u0005[_Ve\f*\u0001\u001a\\R\u000e5\u0000\u0018RYx\r\u0014\b\u0015VPn\u001a6\u001a\u0006\u0015Q^l\u001d+\b\u000f^XeH<\u001b\tXE0H:\u0006\u000e[S+\u00066\u001d[PR\u007fH8\u0019\u000b[^h\t-\u0000\u0014Y\u0017h\u00077\u001d\u001eOC\u0016~I\fVD+\u001d7\f\u0003GRh\u001c<\r[CN{\ry \u0018\u001c\u000f_Re\u001c0\n\u001aC^d\u0006y\u001a\u000eTTn\u001b*I\u001dXE+\u001d*\f\t\u0017";
                var4_3 = "*\f\tA^h\rw\b\u0015XYM\r=\f\tVCn\f\t\u0006\u0017^Tb\r*\u0005\f\u001a\u001eE\u0017Zy\r\u0014RD+\u00066\u001d[_V}\ry\b[TRy\u001cy\u0000\u0015\u0017Sj\u001c8\u000b\u001aDR'H;\u001c\u000f\u0017V~\u001c1\f\u0015C^h\t-\f\u001f\u0017D~\u000b:\f\bDQ~\u00045\u0010[@^\u007f\u0000y!/cg+*8\u001a\u0012T\u0017d\u001e<\u001b[ddG$\u001a\u0005\u0012RY\u007fH:\f\tC\u0017b\u0006y\r\u001aCVi\t*\f[^D+\u00066\u001d[o\u0019>X`\u0017y\u0006\u0015\u0017^o\r7\u001d\u0012CN+\u0018+\u0006\r^Sn\u001acI\u00138\r\u0016^YX\r*\u001a\u0012XYF\t7\b\u001cRE\f*\f\tARy+6\u0007\u001d^P\u0015\u0017\u0006[TEn\f<\u0007\u000f^Vg\u001by\u000f\u0014BYoF(\u0018\u001a\bRE\u007f\u00016\u0007[^D+\f0\u001a\u001aU[n\fuI\u0012PYd\u001a<I\u001aDDn\u001a-\u0000\u0014Y\u0019\u0011:\u0005\u0012RY\u007f+<\u001b\u000fzVe\t>\f\t/\u000f\b\u0017^S+\u000b5\u0000\u001eYC+\u000b<\u001b\u000f\u0017Gy\r*\f\u0015CRoH8\u001a[GVy\u001cy\u0006\u001d\u0017En\u0019,\f\bC\u00190\t\u0006\u0017^TrH+\f\u001dRExH-\u0006[V\u0017e\u00077\f\u0003^D\u007f\r7\u001d[^Sn\u0006-\u0000\u000fN\u0017{\u001a6\u001f\u0012SRy \n\f\tA^h\ry\u001c\u0015VAj\u00015\b\u0019[R+\u00077I\u000f_^xH)\u0006\tC\u0019-\f\u0003C\u0018{\u00048\u0000\u0015\f\u0017h\u00008\u001b\bRC6\u001d-\u000fV\u000f\f\t\u0006\u0017^TrH<\u001b\tXEF\u0018\u0005\u0017\u0017~o\r7\u001d\u0012CNJ\u001b*\f\tC^d\u0006*I\u000bX^e\u001cy\u001d\u0014\u0017V+.<\r\u001eEV\u007f\r=I2sg%H\r\u001b\u001eVCb\u0006>I\u001aD\u0017j\u00066\u0007\u0002ZX~\u001bQ\u001a\u001b\u001eSD+\f6I\u0015XC+\t,\u001d\u0013RY\u007f\u0001:\b\u000fR\u0017j\u000f8\u0000\u0015DC+\t7\u0010[ERl\u0001*\u001d\u001eERoH0\r[GEd\u001e0\r\u001eE\u0017d\u001ay\n\u000eDCd\u0005y\b\bDRy\u001c0\u0006\u0015\u0019\u001e\u001a\f\tC^m\u0001:\b\u000fR\u0017h\u0000<\n\u0010\u0017^xH=\u0000\bVUg\r=G\u000e)\b\bD@d\u001a=!\u001aD_n\u001a\r)\u0006\u0017^Tr%8\u0007\u001aPRy\u001f\u0018\u001c\u000f_Re\u001c0\n\u001aC^d\u0006y\u000f\u001a^[n\fy\u000f\u0014E\u0017~\u001b<\u001b[\t.\u001a\u000beRj\f<\u001b\r\u0018\u001c\u000f_Xy\u0001#\b\u000f^Xe\u001e\u0017\u0006[VB\u007f\u00006\u001b\u0012MV\u007f\u00016\u0007[_Rj\f<\u001b[QX~\u0006=G\u001f\u001c\u0011\u0018RG\u007f\u00016\u0007[PR\u007f\u001c0\u0007\u001c\u0017^oH)\u001b\u0014A^o\r+\u001aU\u0005\f\u001a\u001eE\u0017\u0007\f\u0007\u0010YX|\u0006\f*\f\tA^h\r\u001a\b\u0018_R\u001d\u001b\b\b^T+\u001a<\b\u0017Z\n)$n:(puj\u001b0\n)RVg\u0005{0\t\u0006\u0017^TrH+\f\u001dRExH-\u0006[V\u0017e\u00077\f\u0003^D\u007f\r7\u001d[^Sn\u0006-\u0000\u000fN\u0017{\u001a6\u001f\u0012SRy\u001b\u001a\u0006\u0015Q^l\u001d+\b\u000f^XeH<\u001b\tXE0H;\f\u001aY\u0017,\u0017y\u0006\u0015\u0017^o\r7\u001d\u0012CN+\u0018+\u0006\r^Sn\u001acI=\u001a\u001b\u001eSD+\f6I\u0015XC+\t,\u001d\u0013RY\u007f\u0001:\b\u000fR\u0017j\u000f8\u0000\u0015DC+\t7\u0010[ERl\u0001*\u001d\u001eERoH0\r[GEd\u001e0\r\u001eE\u0019 \u001c\u001b\tXE+\u000e0\u0007\u001f^YlH0\r\u001eYCb\u001c I\u000bEX}\u0001=\f\t\u0019:\u0014\b\u0003\u0019\u0017e\u001d4\u000b\u001eE\u0017d\u000ey\u000f\u001a^[n\fy\b\u000fCRf\u0018-\u001a[_VxH;\f\u001eY\u0017y\r8\n\u0013RS+\u000e6\u001b[BDn\u001ayNry\u0001\u001aD\u0017}\t5\u0000\u001f\u0017Uj\u001b0\n[TEn\f<\u0007\u000f^Vg\u001by\u000b\u000eC\u0017b\u001by\u001b\u001eQBx\r=I\u001aBCc\r7\u001d\u0012TV\u007f\u00016\u0007[URh\t,\u001a\u001e\u0017_nH=\u0000\u001f\u0017Yd\u001cy\u0019\tXAnH)\u0006\bDRx\u001b0\u0006\u0015\u0017XmH1\u0000\b\u0017Tg\u0001<\u0007\u000f\u0017Tn\u001a-G2:\u0006\u0016\u0019[<\u001c<\n\u0013\u0019Dn\u001a/\f\t\u0019Dn\u001a/\u0000\u0018RD%\u000b1\f\u0018\\tn\u001a-\u0000\u001d^Tj\u001c<9\tRDn\u0006- \u001c\u0011\u0018RG\u007f\u00016\u0007[[Xd\u00030\u0007\u001c\u0017Qd\u001ay\f\u0003TR{\u001c0\u0006\u0015\u0019#\u001a\u0006\u0015Q^l\u001d+\b\u000f^XeH<\u001b\tXE0H:\u0006\u000e[S+\u00066\u001d[PR\u007fH\u001b\t\u001b\u0014A^o\r+I\u0015XC+\u000e6\u001c\u0015S\u0017m\u0007+I\u000eDRy4\u0011=/g\u0017I\t*\u0000\u0018\u0017V~\u001c1\f\u0015C^h\t-\u0000\u0014Y\u0017b\u001by\u0007\u0014C\u0017j\u00045\u0006\fRS+\u001f0\u001d\u0013XB\u007fH\n:7)\t\u0006\u0017^TrH=\u0006\u001eD\u0017e\u0007-I\u001a[[d\u001fy\b\u0015XYr\u00056\u001c\b\u0017En\u0019,\f\bCD%\u0014\u001c\u001b\tXE+\u000f<\u001d\u000f^YlH,\u001a\u001eED%\u0018\u0018\u001c\u000f_Re\u001c0\n\u001aC^d\u0006y;\u001eFBb\u001a<\rU)\u0011=/g\u0017I\t*\u0000\u0018\u0017^xH;\f\u0012YP+\u0018<\u001b\u0016^C\u007f\r=I\f^Cc\u0007,\u001d[ddGW-\u0001\u001e\u0017V~\u001c1\f\u0015C^h\t-\f\u001f\u0017Bx\r+I\u0013VD+\ty\u001f\u001a[^oH:\f\tC\u0017i\u001d-I\u0013R\u0017{\u001a<\u001a\u001eYCn\fy\b[S^m\u000e<\u001b\u001eYCh\r+\u001d[CX+\u001c1\f[DRy\u001e5\f\u000fg\u001b\b\b^T+\u000b+\f\u001fRY\u007f\u00018\u0005\b\u0017Vy\ry\u001f\u001a[^oH;\u001c\u000f\u0017Cc\ry\n\u0017^Re\u001cy\r\u0012S\u0017e\u0007-I\u000bERx\r7\u001d[_^xH:\u0005\u0012RY\u007fH:\f\tC\u0017j\u001by\u0019\u001aEC+\u0007?I\u000f_R+\u001b*\u0005[_Ve\f*\u0001\u001a\\R\u000e5\u0000\u0018RYx\r\u0014\b\u0015VPn\u001a6\u001a\u0006\u0015Q^l\u001d+\b\u000f^XeH<\u001b\tXE0H:\u0006\u000e[S+\u00066\u001d[PR\u007fH8\u0019\u000b[^h\t-\u0000\u0014Y\u0017h\u00077\u001d\u001eOC\u0016~I\fVD+\u001d7\f\u0003GRh\u001c<\r[CN{\ry \u0018\u001c\u000f_Re\u001c0\n\u001aC^d\u0006y\u001a\u000eTTn\u001b*I\u001dXE+\u001d*\f\t\u0017".length();
                var1_4 = 29;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 24;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = AuthenticatableHttpServlet.a(v0, AuthenticatableHttpServlet.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "JET\u001d\u00171\u000b~E]\u0007T)GvEOT\u0015&DtSU\u001b\u0001;\u000bhOI\u0001\u0011;_i\u0004\u0017sN]\u001a\u0000!_czJ\u001b\u0002!O\u007fX~\u0015\u0017<DhS";
                    var4_3 = "JET\u001d\u00171\u000b~E]\u0007T)GvEOT\u0015&DtSU\u001b\u0001;\u000bhOI\u0001\u0011;_i\u0004\u0017sN]\u001a\u0000!_czJ\u001b\u0002!O\u007fX~\u0015\u0017<DhS".length();
                    var1_4 = 37;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 91;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = AuthenticatableHttpServlet.a(v0, AuthenticatableHttpServlet.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        AuthenticatableHttpServlet.a = var5;
        AuthenticatableHttpServlet.checkCertificatePresent = ConfigFactory.getBooleanProperty((String)AuthenticatableHttpServlet.a[36], (boolean)true);
    }

    private static Exception c(Exception exception) {
        return exception;
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(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 -> 65;
                    case 1 -> 113;
                    case 2 -> 99;
                    case 3 -> 47;
                    case 4 -> 47;
                    case 5 -> 19;
                    default -> 112;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    protected static class AhsAuthResult {
        private final boolean a;
        private final AuthenticationResult[] b;

        public AhsAuthResult(boolean bl2, AuthenticationResult[] authenticationResultArray) {
            if (authenticationResultArray == null) {
                throw new IllegalArgumentException();
            }
            this.a = bl2;
            this.b = authenticationResultArray;
        }

        public boolean isSawCredentials() {
            return this.a;
        }

        public AuthenticationResult[] getAuthResults() {
            return this.b;
        }
    }
}

