TF-571 Check OIDC is available
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
|
||||
import 'package:model/oidc/request/oidc_request.dart';
|
||||
|
||||
abstract class AuthenticationOIDCRepository {
|
||||
Future<bool> checkOIDCIsAvailable(OIDCRequest oidcRequest);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:core/core.dart';
|
||||
|
||||
class CheckOIDCIsAvailableSuccess extends UIState {
|
||||
|
||||
CheckOIDCIsAvailableSuccess();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class CheckOIDCIsAvailableFailure extends FeatureFailure {
|
||||
final dynamic exception;
|
||||
|
||||
CheckOIDCIsAvailableFailure(this.exception);
|
||||
|
||||
@override
|
||||
List<Object> get props => [exception];
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/repository/authentication_oidc_repository.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/state/check_oidc_is_available_state.dart';
|
||||
|
||||
class CheckOIDCIsAvailableInteractor {
|
||||
final AuthenticationOIDCRepository _oidcRepository;
|
||||
|
||||
CheckOIDCIsAvailableInteractor(this._oidcRepository);
|
||||
|
||||
Future<Either<Failure, Success>> execute(OIDCRequest oidcRequest) async {
|
||||
try {
|
||||
final result = await _oidcRepository.checkOIDCIsAvailable(oidcRequest);
|
||||
log('CheckOIDCIsAvailableInteractor::execute(): result: $result');
|
||||
return result
|
||||
? Right<Failure, Success>(CheckOIDCIsAvailableSuccess())
|
||||
: Left<Failure, Success>(CheckOIDCIsAvailableFailure(null));
|
||||
} catch (e) {
|
||||
log('CheckOIDCIsAvailableInteractor::execute(): ERROR: $e');
|
||||
return Left<Failure, Success>(CheckOIDCIsAvailableFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user