Skip to content

Commit 2663c68

Browse files
author
serverpod_cloud
committed
feat!: 182fce1dd9f63e1a0fec13f85568452f7d640c81
1 parent 37a9934 commit 2663c68

88 files changed

Lines changed: 1807 additions & 1540 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ground_control_client/example/main.dart

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,22 @@ var url = 'http://localhost:8080/';
77
Future<void> main() async {
88
var client = Client(
99
url,
10-
authenticationKeyManager: _SimpleAuthenticationKeyManager(),
11-
);
10+
)..authKeyProvider = _SimpleAuthenticationKeyManager('mock-token');
1211

1312
client.close();
1413
}
1514

1615
// Simple implementation for managing authentication keys.
17-
class _SimpleAuthenticationKeyManager extends AuthenticationKeyManager {
16+
class _SimpleAuthenticationKeyManager implements ClientAuthKeyProvider {
1817
String? _key;
1918

20-
@override
21-
Future<String?> get() async {
22-
return _key;
23-
}
24-
25-
@override
26-
Future<void> put(String key) async {
27-
_key = key;
28-
}
19+
_SimpleAuthenticationKeyManager(this._key);
2920

3021
@override
31-
Future<void> remove() async {
32-
_key = null;
22+
Future<String?> get authHeaderValue async {
23+
return switch (_key) {
24+
final String key => wrapAsBearerAuthHeaderValue(key),
25+
null => null,
26+
};
3327
}
3428
}

0 commit comments

Comments
 (0)