/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.password.IncorrectPasswordException
 *  com.l7tech.common.password.PasswordHasher
 *  com.l7tech.gateway.common.audit.AssertionMessages
 *  com.l7tech.gateway.common.audit.Audit
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.gateway.common.audit.SystemMessages
 *  com.l7tech.identity.AuthenticationException
 *  com.l7tech.identity.BadCredentialsException
 *  com.l7tech.identity.IdentityProviderConfig
 *  com.l7tech.identity.InvalidIdProviderCfgException
 *  com.l7tech.identity.MissingCredentialsException
 *  com.l7tech.identity.User
 *  com.l7tech.identity.ValidationException
 *  com.l7tech.identity.cert.ClientCertManager$VetoSave
 *  com.l7tech.identity.internal.InternalGroup
 *  com.l7tech.identity.internal.InternalUser
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.policy.assertion.credential.CredentialFormat
 *  com.l7tech.policy.assertion.credential.LoginCredentials
 *  com.l7tech.security.token.SshSecurityToken
 *  com.l7tech.util.Charsets
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.HexUtils
 *  com.l7tech.util.SyspropUtil
 *  org.apache.commons.lang3.StringUtils
 *  org.springframework.beans.BeansException
 *  org.springframework.context.ApplicationContext
 *  org.springframework.context.ApplicationContextAware
 *  org.springframework.context.ApplicationEvent
 *  org.springframework.transaction.annotation.Propagation
 *  org.springframework.transaction.annotation.Transactional
 */
package com.l7tech.server.identity.internal;

import com.l7tech.common.password.IncorrectPasswordException;
import com.l7tech.common.password.PasswordHasher;
import com.l7tech.gateway.common.audit.AssertionMessages;
import com.l7tech.gateway.common.audit.Audit;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.gateway.common.audit.SystemMessages;
import com.l7tech.identity.AuthenticationException;
import com.l7tech.identity.BadCredentialsException;
import com.l7tech.identity.IdentityProviderConfig;
import com.l7tech.identity.InvalidIdProviderCfgException;
import com.l7tech.identity.MissingCredentialsException;
import com.l7tech.identity.User;
import com.l7tech.identity.ValidationException;
import com.l7tech.identity.cert.ClientCertManager;
import com.l7tech.identity.internal.InternalGroup;
import com.l7tech.identity.internal.InternalUser;
import com.l7tech.objectmodel.FindException;
import com.l7tech.policy.assertion.credential.CredentialFormat;
import com.l7tech.policy.assertion.credential.LoginCredentials;
import com.l7tech.security.token.SshSecurityToken;
import com.l7tech.server.audit.Auditor;
import com.l7tech.server.event.identity.Authenticated;
import com.l7tech.server.identity.AuthenticationResult;
import com.l7tech.server.identity.ConfigurableIdentityProvider;
import com.l7tech.server.identity.DigestAuthenticator;
import com.l7tech.server.identity.PersistentIdentityProviderImpl;
import com.l7tech.server.identity.SessionAuthenticator;
import com.l7tech.server.identity.cert.CertificateAuthenticator;
import com.l7tech.server.identity.internal.InternalGroupManager;
import com.l7tech.server.identity.internal.InternalIdentityProvider;
import com.l7tech.server.identity.internal.InternalUserManager;
import com.l7tech.server.identity.internal.InternalUserPasswordManager;
import com.l7tech.util.Charsets;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.HexUtils;
import com.l7tech.util.SyspropUtil;
import java.security.cert.X509Certificate;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation=Propagation.SUPPORTS, rollbackFor={Throwable.class})
public class InternalIdentityProviderImpl
extends PersistentIdentityProviderImpl<InternalUser, InternalGroup, InternalUserManager, InternalGroupManager>
implements ApplicationContextAware,
InternalIdentityProvider,
ConfigurableIdentityProvider {
    private static final Logger a;
    private static final boolean b;
    private IdentityProviderConfig c;
    private InternalUserManager d;
    private InternalGroupManager e;
    private CertificateAuthenticator f;
    private SessionAuthenticator g;
    private ApplicationContext h;
    private Auditor i;
    private PasswordHasher j;
    private static final String[] k;

    public InternalUserManager getUserManager() {
        return this.d;
    }

    public InternalGroupManager getGroupManager() {
        return this.e;
    }

    @Override
    @Transactional(propagation=Propagation.REQUIRED, noRollbackFor={AuthenticationException.class})
    public AuthenticationResult authenticate(LoginCredentials loginCredentials) throws AuthenticationException {
        return this.authenticate(loginCredentials, false);
    }

    @Override
    @Transactional(propagation=Propagation.REQUIRED, noRollbackFor={AuthenticationException.class})
    public AuthenticationResult authenticate(LoginCredentials loginCredentials, boolean bl2) throws AuthenticationException {
        AuthenticationResult authenticationResult;
        CredentialFormat credentialFormat;
        block14: {
            InternalUser internalUser;
            block13: {
                block12: {
                    String string = loginCredentials.getLogin();
                    internalUser = this.a(string);
                    try {
                        if (internalUser == null) {
                            a.info(k[10] + string);
                            return null;
                        }
                    }
                    catch (AuthenticationException authenticationException) {
                        throw InternalIdentityProviderImpl.a((Exception)((Object)authenticationException));
                    }
                    this.a(string, internalUser);
                    credentialFormat = loginCredentials.getFormat();
                    try {
                        if (!credentialFormat.isClientCert() && credentialFormat != CredentialFormat.SAML) break block12;
                    }
                    catch (AuthenticationException authenticationException) {
                        throw InternalIdentityProviderImpl.a((Exception)((Object)authenticationException));
                    }
                    authenticationResult = this.f.authenticateX509Credentials(loginCredentials, (User)internalUser, this.c.getCertificateValidationType(), (Audit)this.i);
                    break block14;
                }
                if (credentialFormat == CredentialFormat.SESSIONTOKEN) {
                    authenticationResult = this.g.authenticateSessionCredentials(loginCredentials, (User)internalUser);
                } else {
                    try {
                        if (loginCredentials.getSecurityToken() == null || !(loginCredentials.getSecurityToken() instanceof SshSecurityToken)) break block13;
                    }
                    catch (AuthenticationException authenticationException) {
                        throw InternalIdentityProviderImpl.a((Exception)((Object)authenticationException));
                    }
                    authenticationResult = this.a(loginCredentials, internalUser);
                }
                break block14;
            }
            authenticationResult = this.a(loginCredentials, internalUser, bl2);
        }
        try {
            if (authenticationResult == null) {
                throw new AuthenticationException(k[12] + String.valueOf(credentialFormat));
            }
        }
        catch (AuthenticationException authenticationException) {
            throw InternalIdentityProviderImpl.a((Exception)((Object)authenticationException));
        }
        this.h.publishEvent((ApplicationEvent)new Authenticated(authenticationResult));
        return authenticationResult;
    }

    private InternalUser a(String string) throws AuthenticationException {
        InternalUser internalUser;
        try {
            internalUser = (InternalUser)this.d.findByLogin(string);
        }
        catch (FindException findException) {
            throw new AuthenticationException(k[28], (Throwable)findException);
        }
        return internalUser;
    }

    private void a(String string, InternalUser internalUser) throws AuthenticationException {
        if (!internalUser.isEnabled()) {
            String[] stringArray = k;
            String string2 = stringArray[18] + string + stringArray[30];
            a.info(string2);
            this.i.logAndAudit((AuditDetailMessage)SystemMessages.AUTH_USER_DISABLED, string);
            throw new AuthenticationException(string2);
        }
        if (this.a(internalUser)) {
            String[] stringArray = k;
            String string3 = stringArray[13] + string + stringArray[14];
            a.info(string3);
            this.i.logAndAudit((AuditDetailMessage)SystemMessages.AUTH_USER_EXPIRED, string);
            throw new AuthenticationException(string3);
        }
    }

    @Override
    public InternalUser findUserByCredential(LoginCredentials loginCredentials) throws FindException {
        InternalUser internalUser = null;
        if (loginCredentials.getFormat() == CredentialFormat.SESSIONTOKEN) {
            String string = this.g.getUserId(loginCredentials);
            if (string != null) {
                internalUser = (InternalUser)this.d.findByPrimaryKey(string);
            }
        } else {
            String string = loginCredentials.getLogin();
            if (string != null) {
                internalUser = (InternalUser)this.d.findByLogin(string);
            }
        }
        return internalUser;
    }

    private AuthenticationResult a(LoginCredentials loginCredentials, InternalUser internalUser) throws MissingCredentialsException, BadCredentialsException {
        SshSecurityToken sshSecurityToken = (SshSecurityToken)loginCredentials.getSecurityToken();
        String string = sshSecurityToken.getPublicKey();
        if (StringUtils.isEmpty((CharSequence)string)) {
            String[] stringArray = k;
            String string2 = stringArray[20] + sshSecurityToken.getUsername();
            try {
                if (a.isLoggable(Level.INFO)) {
                    a.info(string2);
                }
            }
            catch (MissingCredentialsException missingCredentialsException) {
                throw InternalIdentityProviderImpl.a((Exception)((Object)missingCredentialsException));
            }
            throw new MissingCredentialsException(string2);
        }
        String string3 = internalUser.getProperty(InternalUser.PROPERTIES_KEY_SSH_USER_PUBLIC_KEY);
        if (StringUtils.isEmpty((CharSequence)string3)) {
            String[] stringArray = k;
            String string4 = stringArray[2] + sshSecurityToken.getUsername();
            try {
                if (a.isLoggable(Level.INFO)) {
                    a.info(string4);
                }
            }
            catch (MissingCredentialsException missingCredentialsException) {
                throw InternalIdentityProviderImpl.a((Exception)((Object)missingCredentialsException));
            }
            throw new BadCredentialsException(string4);
        }
        String[] stringArray = k;
        string3 = string3.replace(SyspropUtil.getProperty((String)stringArray[16]), "");
        if (!(string3 = string3.replace("\n", "")).equals(string)) {
            String string5 = stringArray[6] + sshSecurityToken.getUsername();
            try {
                if (a.isLoggable(Level.INFO)) {
                    a.info(string5);
                }
            }
            catch (MissingCredentialsException missingCredentialsException) {
                throw InternalIdentityProviderImpl.a((Exception)((Object)missingCredentialsException));
            }
            throw new BadCredentialsException(string5);
        }
        return new AuthenticationResult((User)internalUser, loginCredentials.getSecurityTokens());
    }

    /*
     * Loose catch block
     */
    private AuthenticationResult a(LoginCredentials loginCredentials, InternalUser internalUser, boolean bl2) throws MissingCredentialsException, BadCredentialsException {
        CredentialFormat credentialFormat;
        block48: {
            boolean bl3;
            BadCredentialsException badCredentialsException;
            String string;
            block47: {
                String[] stringArray;
                char[] cArray;
                block45: {
                    block46: {
                        block54: {
                            String string2;
                            String string3;
                            block53: {
                                boolean bl4;
                                block52: {
                                    boolean bl5;
                                    block44: {
                                        block43: {
                                            block41: {
                                                block42: {
                                                    boolean bl6;
                                                    String string4;
                                                    block40: {
                                                        block39: {
                                                            credentialFormat = loginCredentials.getFormat();
                                                            string = internalUser.getLogin();
                                                            cArray = loginCredentials.getCredentials();
                                                            stringArray = k;
                                                            badCredentialsException = new BadCredentialsException(stringArray[24]);
                                                            if (credentialFormat != CredentialFormat.CLEARTEXT) break block48;
                                                            string4 = internalUser.getHashedPassword();
                                                            if (string4 == null) break block39;
                                                            try {
                                                                block49: {
                                                                    if (string4.trim().isEmpty()) break block39;
                                                                    break block49;
                                                                    catch (IncorrectPasswordException incorrectPasswordException) {
                                                                        throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                                                    }
                                                                }
                                                                bl6 = true;
                                                                break block40;
                                                            }
                                                            catch (IncorrectPasswordException incorrectPasswordException) {
                                                                throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                                            }
                                                        }
                                                        bl6 = false;
                                                    }
                                                    boolean bl7 = bl6;
                                                    bl3 = false;
                                                    if (!bl7) break block41;
                                                    try {
                                                        if (this.j.isVerifierRecognized(string4)) {
                                                            this.j.verifyPassword(new String(cArray).getBytes(Charsets.UTF8), string4);
                                                            bl3 = true;
                                                        }
                                                    }
                                                    catch (IncorrectPasswordException incorrectPasswordException) {
                                                        // empty catch block
                                                    }
                                                    if (bl3) break block41;
                                                    try {
                                                        block50: {
                                                            if (!a.isLoggable(Level.INFO)) break block42;
                                                            break block50;
                                                            catch (IncorrectPasswordException incorrectPasswordException) {
                                                                throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                                            }
                                                        }
                                                        a.info(k[8] + string);
                                                    }
                                                    catch (IncorrectPasswordException incorrectPasswordException) {
                                                        throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                                    }
                                                }
                                                throw badCredentialsException;
                                            }
                                            string3 = internalUser.getHttpDigest();
                                            if (string3 == null) break block43;
                                            try {
                                                block51: {
                                                    if (string3.trim().isEmpty()) break block43;
                                                    break block51;
                                                    catch (IncorrectPasswordException incorrectPasswordException) {
                                                        throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                                    }
                                                }
                                                bl5 = true;
                                                break block44;
                                            }
                                            catch (IncorrectPasswordException incorrectPasswordException) {
                                                throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                            }
                                        }
                                        bl5 = false;
                                    }
                                    bl4 = bl5;
                                    string2 = HexUtils.encodePasswd((String)string, (String)new String(cArray), (String)HexUtils.REALM);
                                    if (bl3) break block45;
                                    if (!b) break block45;
                                    break block52;
                                    catch (IncorrectPasswordException incorrectPasswordException) {
                                        throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                    }
                                }
                                if (!bl4) break block45;
                                break block53;
                                catch (IncorrectPasswordException incorrectPasswordException) {
                                    throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                }
                            }
                            if (!string2.equals(string3)) break block45;
                            break block54;
                            catch (IncorrectPasswordException incorrectPasswordException) {
                                throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                            }
                        }
                        try {
                            block55: {
                                if (!a.isLoggable(Level.FINE)) break block46;
                                break block55;
                                catch (IncorrectPasswordException incorrectPasswordException) {
                                    throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                                }
                            }
                            a.log(Level.FINE, k[0] + internalUser.getLogin() + k[25]);
                        }
                        catch (IncorrectPasswordException incorrectPasswordException) {
                            throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                        }
                    }
                    bl3 = true;
                }
                try {
                    if (!bl3 || !bl2) break block47;
                }
                catch (IncorrectPasswordException incorrectPasswordException) {
                    throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
                }
                InternalUserPasswordManager internalUserPasswordManager = this.d.getUserPasswordManager();
                boolean bl8 = internalUserPasswordManager.configureUserPasswordHashes(internalUser, new String(cArray));
                if (bl8) {
                    try {
                        InternalUser internalUser2 = new InternalUser();
                        internalUser2.copyFrom((User)internalUser);
                        internalUser2.setVersion(internalUser.getVersion());
                        this.d.update((User)internalUser2);
                        stringArray = k;
                        a.log(Level.FINE, stringArray[27] + string + stringArray[21]);
                    }
                    catch (Exception exception) {
                        stringArray = k;
                        String string5 = stringArray[3] + internalUser.getLogin() + stringArray[19] + ExceptionUtils.getMessage((Throwable)exception);
                        this.i.logAndAudit((AuditDetailMessage)AssertionMessages.EXCEPTION_WARNING_WITH_MORE_INFO, new String[]{string5}, ExceptionUtils.getDebugException((Throwable)exception));
                    }
                }
            }
            try {
                if (bl3) {
                    return new AuthenticationResult((User)internalUser, loginCredentials.getSecurityTokens());
                }
            }
            catch (IncorrectPasswordException incorrectPasswordException) {
                throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
            }
            try {
                if (a.isLoggable(Level.INFO)) {
                    a.info(k[23] + string);
                }
            }
            catch (IncorrectPasswordException incorrectPasswordException) {
                throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
            }
            throw badCredentialsException;
        }
        try {
            if (credentialFormat == CredentialFormat.DIGEST) {
                return DigestAuthenticator.authenticateDigestCredentials(loginCredentials, (User)internalUser);
            }
        }
        catch (IncorrectPasswordException incorrectPasswordException) {
            throw InternalIdentityProviderImpl.a((Exception)((Object)incorrectPasswordException));
        }
        this.a(credentialFormat);
        return null;
    }

    private void a(CredentialFormat credentialFormat) {
        IllegalArgumentException illegalArgumentException = new IllegalArgumentException(k[26] + credentialFormat.toString());
        a.log(Level.WARNING, illegalArgumentException.toString(), illegalArgumentException);
        throw illegalArgumentException;
    }

    public IdentityProviderConfig getConfig() {
        return this.c;
    }

    public String getAuthRealm() {
        return HexUtils.REALM;
    }

    public void test(boolean bl2, String string, char[] cArray) {
    }

    public void preSaveClientCert(InternalUser internalUser, X509Certificate[] x509CertificateArray) throws ClientCertManager.VetoSave {
    }

    public void setUserManager(InternalUserManager internalUserManager) {
        this.d = internalUserManager;
    }

    public void setGroupManager(InternalGroupManager internalGroupManager) {
        this.e = internalGroupManager;
    }

    public void setCertificateAuthenticator(CertificateAuthenticator certificateAuthenticator) {
        this.f = certificateAuthenticator;
    }

    @Override
    public void setIdentityProviderConfig(IdentityProviderConfig identityProviderConfig) throws InvalidIdProviderCfgException {
        try {
            this.c = identityProviderConfig;
            if (this.d == null) {
                throw new InvalidIdProviderCfgException(k[7]);
            }
        }
        catch (InvalidIdProviderCfgException invalidIdProviderCfgException) {
            throw InternalIdentityProviderImpl.a((Exception)((Object)invalidIdProviderCfgException));
        }
        try {
            this.d.configure(this);
            if (this.e != null) {
                this.e.configure(this);
            }
        }
        catch (InvalidIdProviderCfgException invalidIdProviderCfgException) {
            throw InternalIdentityProviderImpl.a((Exception)((Object)invalidIdProviderCfgException));
        }
        this.g = new SessionAuthenticator(this.c.getGoid());
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.h = applicationContext;
        this.i = new Auditor(this, applicationContext, a);
    }

    public void setPasswordHasher(PasswordHasher passwordHasher) {
        this.j = passwordHasher;
    }

    @Override
    public void validate(InternalUser internalUser) throws ValidationException {
        InternalUser internalUser2;
        try {
            internalUser2 = (InternalUser)this.d.findByPrimaryKey(internalUser.getId());
        }
        catch (FindException findException) {
            String[] stringArray = k;
            throw new ValidationException(stringArray[11] + internalUser.getLogin() + stringArray[22], (Throwable)findException);
        }
        try {
            if (internalUser2 == null) {
                throw new ValidationException(k[17] + internalUser.getLogin() + k[29]);
            }
        }
        catch (FindException findException) {
            throw InternalIdentityProviderImpl.a((Exception)((Object)findException));
        }
        try {
            if (!internalUser2.isEnabled()) {
                throw new ValidationException(k[9] + internalUser.getLogin() + k[5]);
            }
        }
        catch (FindException findException) {
            throw InternalIdentityProviderImpl.a((Exception)((Object)findException));
        }
        try {
            if (this.a(internalUser2)) {
                throw new ValidationException(k[9] + internalUser.getLogin() + k[1]);
            }
        }
        catch (FindException findException) {
            throw InternalIdentityProviderImpl.a((Exception)((Object)findException));
        }
    }

    private boolean a(InternalUser internalUser) {
        boolean bl2;
        block2: {
            bl2 = false;
            try {
                if (internalUser.getExpiration() <= -1L || internalUser.getExpiration() >= System.currentTimeMillis()) break block2;
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw InternalIdentityProviderImpl.a(illegalArgumentException);
            }
            bl2 = true;
        }
        return bl2;
    }

    public boolean hasClientCert(String string) throws AuthenticationException {
        try {
            InternalUser internalUser = (InternalUser)this.d.findByLogin(string);
            if (internalUser == null) {
                return false;
            }
            X509Certificate x509Certificate = (X509Certificate)this.clientCertManager.getUserCert((User)internalUser);
            if (x509Certificate != null) {
                return true;
            }
        }
        catch (FindException findException) {
            throw new AuthenticationException(k[4], (Throwable)findException);
        }
        return false;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[31];
                var3_1 = 0;
                var2_2 = "oO\u001e\nTfgGY\u000b\u0016Tl3[I\u000f\u0010\u0011/$\t\u001a\u000e\u000bU(}ANJ\u0014PdzJ[\u001e\u0007\u0011 vVJ\u0003\u0010Tl3OY\t\rDfg\u00075`UJ1b@3^O\b\u000eXk3E_\u0013BWgf@^J\u000b_(wON\u000b\u0000P{v\u000eH\u000f\u0001^zw\u000e\\\u0005\u0010\u0011d|IS\u0004B.mU\u001f\u000eU(}ANJ\u0017AoaO^\u000fBAi`]M\u0005\u0010U(`ZU\u0018\u0003Vm3HU\u0018B]gtGTJE!mU\u001f\u000eUf4Z\u001a\u000b\u0017E`v@N\u0003\u0001P|v\u000eY\u0018\u0007Um}ZS\u000b\u000eB%\t\u001a\u000e\u000bU(}ANJ\u0014PdzJ[\u001e\u0007\u0011 wGI\u000b\u0000]mw\u000e[\t\u0001^}}Z\u0013\u001fgT\t\rCzvMNJ\u0012Dj\u007fGYJ\tTq3HU\u0018B]gtGTJ\u0016{I\u000f\u0010|i}O]\u000f\u0010\u0011a`\u000eT\u0005\u0016\u0011{vZ\u001dgT\t\rCzvMNJ\u0012P{`YU\u0018\u0006\u0011n|\\\u001a\u0006\rVa}\u000e\u0006{I\u000f\u0010\u0011/\u001emU\u001f\u000eUf4Z\u001a\f\u000b_l3[I\u000f\u0010\u0011\u007fzZRJ\u000e^oz@\u001a\u0006{I\u000f\u0010\u0011/8oO\u001e\nTfgGY\u000b\u0016Xg}\u000eJ\u0018\rU}pK^J\f^(aKI\u001f\u000eE(uAHJ\u0001CmwKT\u001e\u000bPd3HU\u0018\u000fP|3,mH\u000f\u0006TfgG[\u0006\u0011\u0016(\u007fA]\u0003\f\u0011erZY\u0002\u0007B(r@\u001a\u0003\fEma@[\u0006BD{v\\\u001a!\u000eX\u001f\u0016\u0011|{ONJ\u0003Rk|[T\u001eBX{3@U\u001dBTpcGH\u000f\u0006\u001f7MU\u0007L]?gKY\u0002LBmaX_\u0018LXlv@N\u0003\u0016H&z@N\u000f\u0010_i\u007f\u0000[\u0006\u000e^\u007fWG]\u000f\u0011ENrBV\b\u0003Rc\u000eBS\u0004\u0007\u001f{v^[\u0018\u0003Ega\u0016g^\u000f\fEagWj\u0018\rGawKHJ7Bma\u000e,mH\u000f\u0006TfgG[\u0006\u0011\u0016(\u007fA]\u0003\f\u0011erZY\u0002\u0007B(r@\u001a\u0003\fEma@[\u0006BD{v\\\u001a\u0003\t\u0014J%`UJ1b@3^O\b\u000eXk3E_\u0013BAz|XS\u000e\u0007U(uAHJ\u000e^oz@\u001a\u0002\t\u0014\u0013\t\u001a\u000e\u000bU(}ANJ\u0014PdzJ[\u001e\u0007\u001f\u001dgT\t\rCzvMNJ\u0012P{`YU\u0018\u0006\u0011n|\\\u001a\u0006\rVa}\u000e\u0010gT\u001c\u0003]aw\u000eJ\u000b\u0011B\u007f|\\^-\t\u001a\u001f\u0011Xft\u000eR\u001e\u0016A(wG]\u000f\u0011E(pAW\u001a\u0003EaqB_J\u0012P{`YU\u0018\u0006\u0011`r]RD\u001f{T\u0019\u0017Ax|\\N\u000f\u0006\u0011kaK^\u000f\fEarB\u001a\f\rCerZ\u0000J/{J\r\u0010PlvJ\u001a\u001a\u0003B{dAH\u000eBB||\\[\r\u0007\u0011n|\\\u001a\u001f\u0011Tz3YS\u001e\n\u0011d|IS\u0004B\u0016!mU\u001f\u000eUf4Z\u001a\u000b\u0017E`v@N\u0003\u0001P|v\u000eY\u0018\u0007Um}ZS\u000b\u000eB";
                var4_3 = "oO\u001e\nTfgGY\u000b\u0016Tl3[I\u000f\u0010\u0011/$\t\u001a\u000e\u000bU(}ANJ\u0014PdzJ[\u001e\u0007\u0011 vVJ\u0003\u0010Tl3OY\t\rDfg\u00075`UJ1b@3^O\b\u000eXk3E_\u0013BWgf@^J\u000b_(wON\u000b\u0000P{v\u000eH\u000f\u0001^zw\u000e\\\u0005\u0010\u0011d|IS\u0004B.mU\u001f\u000eU(}ANJ\u0017AoaO^\u000fBAi`]M\u0005\u0010U(`ZU\u0018\u0003Vm3HU\u0018B]gtGTJE!mU\u001f\u000eUf4Z\u001a\u000b\u0017E`v@N\u0003\u0001P|v\u000eY\u0018\u0007Um}ZS\u000b\u000eB%\t\u001a\u000e\u000bU(}ANJ\u0014PdzJ[\u001e\u0007\u0011 wGI\u000b\u0000]mw\u000e[\t\u0001^}}Z\u0013\u001fgT\t\rCzvMNJ\u0012Dj\u007fGYJ\tTq3HU\u0018B]gtGTJ\u0016{I\u000f\u0010|i}O]\u000f\u0010\u0011a`\u000eT\u0005\u0016\u0011{vZ\u001dgT\t\rCzvMNJ\u0012P{`YU\u0018\u0006\u0011n|\\\u001a\u0006\rVa}\u000e\u0006{I\u000f\u0010\u0011/\u001emU\u001f\u000eUf4Z\u001a\f\u000b_l3[I\u000f\u0010\u0011\u007fzZRJ\u000e^oz@\u001a\u0006{I\u000f\u0010\u0011/8oO\u001e\nTfgGY\u000b\u0016Xg}\u000eJ\u0018\rU}pK^J\f^(aKI\u001f\u000eE(uAHJ\u0001CmwKT\u001e\u000bPd3HU\u0018\u000fP|3,mH\u000f\u0006TfgG[\u0006\u0011\u0016(\u007fA]\u0003\f\u0011erZY\u0002\u0007B(r@\u001a\u0003\fEma@[\u0006BD{v\\\u001a!\u000eX\u001f\u0016\u0011|{ONJ\u0003Rk|[T\u001eBX{3@U\u001dBTpcGH\u000f\u0006\u001f7MU\u0007L]?gKY\u0002LBmaX_\u0018LXlv@N\u0003\u0016H&z@N\u000f\u0010_i\u007f\u0000[\u0006\u000e^\u007fWG]\u000f\u0011ENrBV\b\u0003Rc\u000eBS\u0004\u0007\u001f{v^[\u0018\u0003Ega\u0016g^\u000f\fEagWj\u0018\rGawKHJ7Bma\u000e,mH\u000f\u0006TfgG[\u0006\u0011\u0016(\u007fA]\u0003\f\u0011erZY\u0002\u0007B(r@\u001a\u0003\fEma@[\u0006BD{v\\\u001a\u0003\t\u0014J%`UJ1b@3^O\b\u000eXk3E_\u0013BAz|XS\u000e\u0007U(uAHJ\u000e^oz@\u001a\u0002\t\u0014\u0013\t\u001a\u000e\u000bU(}ANJ\u0014PdzJ[\u001e\u0007\u001f\u001dgT\t\rCzvMNJ\u0012P{`YU\u0018\u0006\u0011n|\\\u001a\u0006\rVa}\u000e\u0010gT\u001c\u0003]aw\u000eJ\u000b\u0011B\u007f|\\^-\t\u001a\u001f\u0011Xft\u000eR\u001e\u0016A(wG]\u000f\u0011E(pAW\u001a\u0003EaqB_J\u0012P{`YU\u0018\u0006\u0011`r]RD\u001f{T\u0019\u0017Ax|\\N\u000f\u0006\u0011kaK^\u000f\fEarB\u001a\f\rCerZ\u0000J/{J\r\u0010PlvJ\u001a\u001a\u0003B{dAH\u000eBB||\\[\r\u0007\u0011n|\\\u001a\u001f\u0011Tz3YS\u001e\n\u0011d|IS\u0004B\u0016!mU\u001f\u000eUf4Z\u001a\u000b\u0017E`v@N\u0003\u0001P|v\u000eY\u0018\u0007Um}ZS\u000b\u000eB".length();
                var1_4 = 20;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = InternalIdentityProviderImpl.b(v0, InternalIdentityProviderImpl.c(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "I\u0013BQV);\u001c\u0013I\u000b\u001eI\u001fXQV;<\b\t\rD\u0015,;\u001c\u0013Y\u0005\u001f<t\r\u0014^D\u0014#1\rS";
                    var4_3 = "I\u0013BQV);\u001c\u0013I\u000b\u001eI\u001fXQV;<\b\t\rD\u0015,;\u001c\u0013Y\u0005\u001f<t\r\u0014^D\u0014#1\rS".length();
                    var1_4 = 11;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 124;
                        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++] = InternalIdentityProviderImpl.b(v0, InternalIdentityProviderImpl.c(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;
            }
        }
        InternalIdentityProviderImpl.k = var5;
        InternalIdentityProviderImpl.a = Logger.getLogger(InternalIdentityProviderImpl.class.getName());
        InternalIdentityProviderImpl.b = ConfigFactory.getBooleanProperty((String)InternalIdentityProviderImpl.k[15], (boolean)true);
    }

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

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(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 -> 21;
                    case 1 -> 1;
                    case 2 -> 81;
                    case 3 -> 89;
                    case 4 -> 10;
                    case 5 -> 51;
                    default -> 40;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

