Search in sources :

Example 51 with FbExceptionBuilder

use of org.firebirdsql.gds.ng.FbExceptionBuilder in project jaybird by FirebirdSQL.

the class ClientAuthBlock method resetClient.

public void resetClient(byte[] serverInfo) throws SQLException {
    if (serverInfo != null) {
        if (currentPlugin != null && currentPlugin.hasServerData()) {
            // We should not change plugins iterator now
            return;
        }
        ClumpletReader serverList = new ClumpletReader(ClumpletReader.Kind.UnTagged, serverInfo);
        if (serverList.find(TAG_KNOWN_PLUGINS)) {
            String serverPluginNames = serverList.getString(StandardCharsets.US_ASCII);
            serverPlugins.clear();
            serverPlugins.addAll(splitPluginList(serverPluginNames));
        }
    }
    firstTime = true;
    currentPlugin = null;
    pluginProviders = getSupportedPluginProviders();
    if (!serverPlugins.isEmpty()) {
        List<AuthenticationPluginSpi> mergedProviderList = new ArrayList<>();
        for (AuthenticationPluginSpi clientProvider : pluginProviders) {
            if (serverPlugins.contains(clientProvider.getPluginName())) {
                mergedProviderList.add(clientProvider);
            }
        }
        if (mergedProviderList.isEmpty()) {
            throw new FbExceptionBuilder().exception(ISCConstants.isc_login).exception(ISCConstants.isc_random).messageParameter("No matching plugins on server").toFlatSQLException();
        }
        pluginProviders = mergedProviderList;
    }
}
Also used : FbExceptionBuilder(org.firebirdsql.gds.ng.FbExceptionBuilder) ClumpletReader(org.firebirdsql.gds.ClumpletReader)

Aggregations

FbExceptionBuilder (org.firebirdsql.gds.ng.FbExceptionBuilder)51 SQLException (java.sql.SQLException)31 IOException (java.io.IOException)27 XdrOutputStream (org.firebirdsql.gds.impl.wire.XdrOutputStream)22 XdrInputStream (org.firebirdsql.gds.impl.wire.XdrInputStream)6 GenericResponse (org.firebirdsql.gds.ng.wire.GenericResponse)6 SQLNonTransientException (java.sql.SQLNonTransientException)4 AbstractWireOperations (org.firebirdsql.gds.ng.wire.AbstractWireOperations)4 Test (org.junit.Test)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 BlobParameterBuffer (org.firebirdsql.gds.BlobParameterBuffer)3 BigInteger (java.math.BigInteger)2 InvalidKeyException (java.security.InvalidKeyException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 SQLNonTransientConnectionException (java.sql.SQLNonTransientConnectionException)2 SQLWarning (java.sql.SQLWarning)2 Cipher (javax.crypto.Cipher)2 NoSuchPaddingException (javax.crypto.NoSuchPaddingException)2 SecretKeySpec (javax.crypto.spec.SecretKeySpec)2 Encoding (org.firebirdsql.encodings.Encoding)2