TF-571 Implement AuthenticationOIDC repository with Hive
This commit is contained in:
committed by
Dat H. Pham
parent
03777be4a8
commit
471465e1bc
@@ -1,12 +1,14 @@
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/datasource/authentication_oidc_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/local/token_oidc_cache_manager.dart';
|
||||
import 'package:tmail_ui_user/features/login/data/network/oidc_http_client.dart';
|
||||
|
||||
class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
|
||||
|
||||
final OIDCHttpClient _oidcHttpClient;
|
||||
final TokenOidcCacheManager _tokenOidcCacheManager;
|
||||
|
||||
AuthenticationOIDCDataSourceImpl(this._oidcHttpClient);
|
||||
AuthenticationOIDCDataSourceImpl(this._oidcHttpClient, this._tokenOidcCacheManager);
|
||||
|
||||
@override
|
||||
Future<OIDCResponse> checkOIDCIsAvailable(OIDCRequest oidcRequest) {
|
||||
@@ -35,4 +37,14 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<TokenOIDC> getStoredTokenOIDC(String tokenIdHash) async {
|
||||
return _tokenOidcCacheManager.getTokenOidc(tokenIdHash);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> persistTokenOIDC(TokenOIDC tokenOidc) async {
|
||||
return _tokenOidcCacheManager.persistOneTokenOidc(tokenOidc);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user