Skip to content

Commit 3a85e06

Browse files
committed
👌 Remove authenticationScheme from PostgreSQLConnection
1 parent ea87688 commit 3a85e06

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

lib/src/auth/auth.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ abstract class PostgresAuthenticator {
1717
void onMessage(AuthenticationMessage message);
1818
}
1919

20-
PostgresAuthenticator createAuthenticator(PostgreSQLConnection connection) {
21-
switch (connection.authenticationScheme) {
20+
PostgresAuthenticator createAuthenticator(PostgreSQLConnection connection, AuthenticationScheme authenticationScheme) {
21+
switch (authenticationScheme) {
2222
case AuthenticationScheme.MD5:
2323
return MD5Authenticator(connection);
2424
case AuthenticationScheme.SCRAM_SHA_256:

lib/src/connection.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:io';
66
import 'dart:typed_data';
77

88
import 'package:buffer/buffer.dart';
9-
import 'package:sasl_scram/sasl_scram.dart';
109
import 'auth/auth.dart';
1110

1211
import 'client_messages.dart';
@@ -74,9 +73,6 @@ class PostgreSQLConnection extends Object
7473
/// Password for authenticating this connection.
7574
final String? password;
7675

77-
/// AuthenticationScheme for authenticating this connection.
78-
AuthenticationScheme authenticationScheme = AuthenticationScheme.SCRAM_SHA_256;
79-
8076
/// Whether or not this connection should connect securely.
8177
final bool useSSL;
8278

lib/src/connection_fsm.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@ class _PostgreSQLConnectionStateAuthenticating
108108
case AuthenticationMessage.KindOK:
109109
return _PostgreSQLConnectionStateAuthenticated(completer);
110110
case AuthenticationMessage.KindMD5Password:
111-
// Change default auth scheme
112-
connection!.authenticationScheme = AuthenticationScheme.MD5;
113-
continue authInit;
114-
authInit:
111+
_authenticator = createAuthenticator(connection!, AuthenticationScheme.MD5);
112+
continue authMsg;
115113
case AuthenticationMessage.KindSASL:
116-
_authenticator = createAuthenticator(connection!);
114+
_authenticator = createAuthenticator(connection!, AuthenticationScheme.SCRAM_SHA_256);
117115
continue authMsg;
118116
authMsg:
119117
case AuthenticationMessage.KindSASLContinue:

0 commit comments

Comments
 (0)