|
|
@ -59,7 +59,8 @@ class DynamiteApiException implements Exception { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
abstract class DynamiteAuthentication { |
|
|
|
abstract class DynamiteAuthentication { |
|
|
|
String get id; |
|
|
|
String get type; |
|
|
|
|
|
|
|
String get scheme; |
|
|
|
Map<String, String> get headers; |
|
|
|
Map<String, String> get headers; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -74,7 +75,11 @@ class DynamiteHttpBasicAuthentication extends DynamiteAuthentication { |
|
|
|
final String password; |
|
|
|
final String password; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
String get id => 'basic_auth'; |
|
|
|
String type = 'http'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
|
|
String scheme = 'basic'; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Map<String, String> get headers => { |
|
|
|
Map<String, String> get headers => { |
|
|
|
'Authorization': 'Basic ${base64.encode(utf8.encode('$username:$password'))}', |
|
|
|
'Authorization': 'Basic ${base64.encode(utf8.encode('$username:$password'))}', |
|
|
@ -89,7 +94,11 @@ class DynamiteHttpBearerAuthentication extends DynamiteAuthentication { |
|
|
|
final String token; |
|
|
|
final String token; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
String get id => 'bearer'; |
|
|
|
String type = 'http'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
|
|
String scheme = 'bearer'; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Map<String, String> get headers => { |
|
|
|
Map<String, String> get headers => { |
|
|
|
'Authorization': 'Bearer $token', |
|
|
|
'Authorization': 'Bearer $token', |
|
|
|