Ask for the password once and retry when a machine requires elevation
Carry the protocol error code, wrap each machine's gateway so an elevation_required refusal shows one native password dialog, elevates that connection and retries; send the upload token with file uploads; add a Settings sign-in security section with the weak-password warning and sign out everywhere; accept the __Host- session cookie.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/session/server_session_io.dart';
|
||||
|
||||
void main() {
|
||||
late HttpServer server;
|
||||
late String setCookie;
|
||||
|
||||
setUp(() async {
|
||||
server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
|
||||
server.listen((request) async {
|
||||
await request.drain<void>();
|
||||
request.response
|
||||
..statusCode = 303
|
||||
..headers.set('Location', '/')
|
||||
..headers.add('Set-Cookie', setCookie);
|
||||
await request.response.close();
|
||||
});
|
||||
});
|
||||
tearDown(() => server.close(force: true));
|
||||
|
||||
Uri login() => Uri.parse('http://127.0.0.1:${server.port}/login');
|
||||
|
||||
for (final name in ['pipelines_session', '__Host-pipelines_session']) {
|
||||
test('keeps the $name session cookie', () async {
|
||||
setCookie = '$name=signed.token; Path=/; HttpOnly; SameSite=Lax';
|
||||
final result = await postLogin(login(), 'password');
|
||||
expect(result.error, isNull);
|
||||
expect(result.cookie, '$name=signed.token');
|
||||
});
|
||||
}
|
||||
|
||||
test('ignores an unrelated cookie', () async {
|
||||
setCookie = 'other=value; Path=/';
|
||||
final result = await postLogin(login(), 'password');
|
||||
expect(result.cookie, isNull);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user