TF-2384 Store data to keychain when save new Account

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 4d84a3354927d1c0becaf0e8e6d7cc8c54721f58)
This commit is contained in:
dab246
2023-12-24 19:24:33 +07:00
committed by Dat H. Pham
parent 940cc2f315
commit a2a1f8246f
22 changed files with 211 additions and 238 deletions
@@ -32,13 +32,20 @@ class AuthenticationInteractor {
final user = await authenticationRepository.authenticationUser(baseUrl, userName, password);
await Future.wait([
credentialRepository.saveBaseUrl(baseUrl),
credentialRepository.storeAuthenticationInfo(AuthenticationInfoCache(userName.value, password.value)),
_accountRepository.setCurrentAccount(PersonalAccount(
credentialRepository.storeAuthenticationInfo(
AuthenticationInfoCache(
userName.value,
password.value
)
),
]);
await _accountRepository.setCurrentAccount(
PersonalAccount(
userName.value,
AuthenticationType.basic,
isSelected: true
))
]);
)
);
yield Right(AuthenticationUserSuccess(user));
} catch (e) {
yield Left(AuthenticationUserFailure(e));
@@ -29,15 +29,20 @@ class GetTokenOIDCInteractor {
config.redirectUrl,
config.discoveryUrl,
config.scopes);
await Future.wait([
_credentialRepository.saveBaseUrl(baseUrl),
_accountRepository.setCurrentAccount(PersonalAccount(
tokenOIDC.tokenIdHash,
AuthenticationType.oidc,
isSelected: true)),
authenticationOIDCRepository.persistTokenOIDC(tokenOIDC),
authenticationOIDCRepository.persistAuthorityOidc(config.authority),
]);
await _accountRepository.setCurrentAccount(
PersonalAccount(
tokenOIDC.tokenIdHash,
AuthenticationType.oidc,
isSelected: true
)
);
yield Right<Failure, Success>(GetTokenOIDCSuccess(tokenOIDC, config));
} catch (e) {
logError('GetTokenOIDCInteractor::execute(): $e');