Line data Source code
1 : import 'dart:io';
2 :
3 : import 'package:agattp/src/auth/agattp_abstract_auth.dart';
4 :
5 : /// Implementation of the Bearer Token authentication strategy
6 : class AgattpAuthBearer implements AgattpAuthInterface {
7 : /// The Bearer Token used for authenticating in the server
8 : final String? token;
9 :
10 1 : const AgattpAuthBearer(this.token);
11 :
12 1 : @override
13 1 : Future<Map<String, String>> getAuthHeaders(_, __) async => <String, String>{
14 2 : if (token?.isNotEmpty ?? false)
15 3 : HttpHeaders.authorizationHeader: 'Bearer $token',
16 : };
17 : }
|