TF-605 Use bearer token download attachment on iOS

This commit is contained in:
dab246
2022-06-02 16:46:08 +07:00
committed by Dat H. Pham
parent 693f4dbc15
commit 69b2dbf3cf
9 changed files with 96 additions and 18 deletions
+14 -9
View File
@@ -4,18 +4,23 @@ import 'package:equatable/equatable.dart';
import 'package:model/model.dart';
class AccountRequest with EquatableMixin {
final UserName userName;
final Password password;
final UserName? userName;
final Password? password;
final Token? token;
final AuthenticationType authenticationType;
AccountRequest(this.userName, this.password);
AccountRequest({
this.userName,
this.password,
this.token,
this.authenticationType = AuthenticationType.none,
});
Map<String, dynamic> toJson() => <String, dynamic>{
'username': userName.userName,
'password': password.value,
};
String get basicAuth =>
'Basic ${base64Encode(utf8.encode('${userName?.userName}:${password?.value}'))}';
String get basicAuth => 'Basic ${base64Encode(utf8.encode('${userName.userName}:${password.value}'))}';
String get bearerToken => 'Bearer ${token?.token}';
@override
List<Object> get props => [userName, password];
List<Object?> get props => [userName, password];
}