diff --git a/integration_tests/create_users.sh b/integration_tests/create_users.sh index 89b3d9f..92e3395 100644 --- a/integration_tests/create_users.sh +++ b/integration_tests/create_users.sh @@ -1,2 +1,4 @@ +set -ex + prosodyctl --config ./prosody.cfg.lua register testuser1 localhost abc123 -prosodyctl --config ./prosody.cfg.lua register testuser2 localhost abc123 \ No newline at end of file +prosodyctl --config ./prosody.cfg.lua register testuser2 localhost abc123 diff --git a/integration_tests/pubspec.yaml b/integration_tests/pubspec.yaml index 9a02a64..0963bfe 100644 --- a/integration_tests/pubspec.yaml +++ b/integration_tests/pubspec.yaml @@ -3,14 +3,16 @@ description: A sample command-line application. version: 1.0.0 environment: - sdk: '>=2.18.0 <3.0.0' + sdk: ">=3.0.0 <4.0.0" dependencies: - logging: ^1.0.2 - moxxmpp: 0.3.0 - moxxmpp_socket_tcp: 0.3.0 - + logging: ^1.3.0 + moxxmpp: + path: ../packages/moxxmpp + moxxmpp_socket_tcp: + path: ../packages/moxxmpp_socket_tcp + dev_dependencies: - lints: ^2.0.0 - test: ^1.16.0 - very_good_analysis: ^3.0.1 + build_runner: ^2.4.13 + test: ^1.25.8 + very_good_analysis: ^6.0.0 diff --git a/integration_tests/test/sasl2_test.dart b/integration_tests/test/sasl2_test.dart index 591cd07..e9fade3 100644 --- a/integration_tests/test/sasl2_test.dart +++ b/integration_tests/test/sasl2_test.dart @@ -4,6 +4,8 @@ import 'package:moxxmpp_socket_tcp/moxxmpp_socket_tcp.dart'; import 'package:test/test.dart'; class TestingTCPSocketWrapper extends TCPSocketWrapper { + TestingTCPSocketWrapper() : super(true); + @override bool onBadCertificate(dynamic certificate, String domain) { return true; @@ -27,7 +29,7 @@ void main() { ClientToServerNegotiator(), TestingTCPSocketWrapper(), )..connectionSettings = ConnectionSettings( - jid: JID.fromString('testuser@localhost'), + jid: JID.fromString('testuser1@localhost'), password: 'abc123', host: '127.0.0.1', port: 5222, @@ -40,6 +42,8 @@ void main() { ]); await conn.registerFeatureNegotiators([ SaslPlainNegotiator(), + SaslScramNegotiator(9, '', '', ScramHashType.sha1), + SaslScramNegotiator(10, '', '', ScramHashType.sha256), ResourceBindingNegotiator(), FASTSaslNegotiator(), Bind2Negotiator(), diff --git a/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/plain.dart b/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/plain.dart index e839a4d..e7931da 100644 --- a/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/plain.dart +++ b/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/plain.dart @@ -96,7 +96,9 @@ class SaslPlainNegotiator extends Sasl2AuthenticationNegotiator { @override Future> onSasl2Success(XMLNode response) async { - state = NegotiatorState.done; + if (pickedForSasl2) { + state = NegotiatorState.done; + } return const Result(true); } diff --git a/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/scram.dart b/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/scram.dart index c210b9b..a801127 100644 --- a/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/scram.dart +++ b/packages/moxxmpp/lib/src/rfcs/rfc_6120/sasl/scram.dart @@ -363,6 +363,11 @@ class SaslScramNegotiator extends Sasl2AuthenticationNegotiator { @override Future> onSasl2Success(XMLNode response) async { + // Don't do anything if we have not been picked for SASL2. + if (!pickedForSasl2) { + return const Result(true); + } + // When we're done with SASL2, check the additional data to verify the server // signature. state = NegotiatorState.done;