use of org.firebirdsql.gds.ClumpletReader in project jaybird by FirebirdSQL.
the class WireConnection method addServerKeys.
void addServerKeys(byte[] serverKeys) throws SQLException {
final ClumpletReader newKeys = new ClumpletReader(ClumpletReader.Kind.UnTagged, serverKeys);
for (newKeys.rewind(); !newKeys.isEof(); newKeys.moveNext()) {
if (newKeys.getClumpTag() == TAG_KNOWN_PLUGINS) {
continue;
}
int currentTag = newKeys.getClumpTag();
if (currentTag != TAG_KEY_TYPE) {
throw new SQLException("Unexpected tag type: " + currentTag);
}
String keyType = newKeys.getString(StandardCharsets.US_ASCII);
newKeys.moveNext();
if (newKeys.isEof()) {
break;
}
currentTag = newKeys.getClumpTag();
if (currentTag != TAG_KEY_PLUGINS) {
throw new SQLException("Unexpected tag type: " + currentTag);
}
String keyPlugins = newKeys.getString(StandardCharsets.US_ASCII);
knownServerKeys.add(new KnownServerKey(keyType, keyPlugins));
}
}
use of org.firebirdsql.gds.ClumpletReader 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;
}
}
Aggregations