feat(xep): FASTSaslNegotiator now only takes a string as its token
This commit is contained in:
parent
aa71d3ed5d
commit
fa2ce7c2d1
@ -60,7 +60,7 @@ class FASTSaslNegotiator extends Sasl2AuthenticationNegotiator {
|
||||
final Logger _log = Logger('FASTSaslNegotiator');
|
||||
|
||||
/// The token, if non-null, to use for authentication.
|
||||
FASTToken? fastToken;
|
||||
String? fastToken;
|
||||
|
||||
@override
|
||||
bool matchesFeature(List<XMLNode> features) {
|
||||
@ -100,11 +100,12 @@ class FASTSaslNegotiator extends Sasl2AuthenticationNegotiator {
|
||||
|
||||
@override
|
||||
Future<Result<bool, NegotiatorError>> onSasl2Success(XMLNode response) async {
|
||||
final token = response.firstTag('token', xmlns: fastXmlns);
|
||||
if (token != null) {
|
||||
fastToken = FASTToken.fromXml(token);
|
||||
final tokenElement = response.firstTag('token', xmlns: fastXmlns);
|
||||
if (tokenElement != null) {
|
||||
final token = FASTToken.fromXml(tokenElement);
|
||||
fastToken = token.token;
|
||||
await attributes.sendEvent(
|
||||
NewFASTTokenReceivedEvent(fastToken!),
|
||||
NewFASTTokenReceivedEvent(token),
|
||||
);
|
||||
}
|
||||
|
||||
@ -155,7 +156,7 @@ class FASTSaslNegotiator extends Sasl2AuthenticationNegotiator {
|
||||
|
||||
@override
|
||||
Future<String> getRawStep(String input) async {
|
||||
return fastToken!.token;
|
||||
return fastToken!;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -141,8 +141,7 @@ void main() {
|
||||
final token = conn
|
||||
.getNegotiatorById<FASTSaslNegotiator>(saslFASTNegotiator)!
|
||||
.fastToken;
|
||||
expect(token != null, true);
|
||||
expect(token!.token, 'WXZzciBwYmFmdmZnZiBqdmd1IGp2eXFhcmZm');
|
||||
expect(token, 'WXZzciBwYmFmdmZnZiBqdmd1IGp2eXFhcmZm');
|
||||
|
||||
// Disconnect
|
||||
await conn.disconnect();
|
||||
@ -232,11 +231,7 @@ void main() {
|
||||
await conn.registerFeatureNegotiators([
|
||||
SaslPlainNegotiator(),
|
||||
ResourceBindingNegotiator(),
|
||||
FASTSaslNegotiator()
|
||||
..fastToken = const FASTToken(
|
||||
'WXZzciBwYmFmdmZnZiBqdmd1IGp2eXFhcmZm',
|
||||
'2020-03-12T14:36:15Z',
|
||||
),
|
||||
FASTSaslNegotiator()..fastToken = 'WXZzciBwYmFmdmZnZiBqdmd1IGp2eXFhcmZm',
|
||||
Sasl2Negotiator()
|
||||
..userAgent = const UserAgent(
|
||||
id: 'd4565fa7-4d72-4749-b3d3-740edbf87770',
|
||||
@ -257,7 +252,6 @@ void main() {
|
||||
final token = conn
|
||||
.getNegotiatorById<FASTSaslNegotiator>(saslFASTNegotiator)!
|
||||
.fastToken;
|
||||
expect(token != null, true);
|
||||
expect(token!.token, 'ed00e36cb42449a365a306a413f51ffd5ea8');
|
||||
expect(token, 'ed00e36cb42449a365a306a413f51ffd5ea8');
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user