TF-3484 Try get oidc configuration if possible when web finger is not available
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
|
||||
import 'package:model/oidc/response/oidc_link_dto.dart';
|
||||
import 'package:model/oidc/response/oidc_response.dart';
|
||||
|
||||
class BaseUrlOidcResponse extends OIDCResponse {
|
||||
|
||||
BaseUrlOidcResponse(Uri baseUri) : super(
|
||||
'',
|
||||
[
|
||||
OIDCLinkDto(baseUri, baseUri)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,9 @@ class GetOIDCConfigurationSuccess extends UIState {
|
||||
class GetOIDCConfigurationFailure extends FeatureFailure {
|
||||
|
||||
GetOIDCConfigurationFailure(dynamic exception) : super(exception: exception);
|
||||
}
|
||||
|
||||
class GetOIDCConfigurationFromBaseUrlFailure extends FeatureFailure {
|
||||
|
||||
GetOIDCConfigurationFromBaseUrlFailure(dynamic exception) : super(exception: exception);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:model/oidc/response/oidc_response.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/model/base_url_oidc_response.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/repository/authentication_oidc_repository.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/state/get_oidc_configuration_state.dart';
|
||||
|
||||
@@ -18,8 +19,12 @@ class GetOIDCConfigurationInteractor {
|
||||
await _oidcRepository.persistOidcConfiguration(oidcConfiguration);
|
||||
yield Right<Failure, Success>(GetOIDCConfigurationSuccess(oidcConfiguration));
|
||||
} catch (e) {
|
||||
log('GetOIDCConfigurationInteractor::execute(): ERROR: $e');
|
||||
yield Left<Failure, Success>(GetOIDCConfigurationFailure(e));
|
||||
logError('$runtimeType::execute():oidcResponse = ${oidcResponse.runtimeType} | Exception = $e');
|
||||
if (oidcResponse is BaseUrlOidcResponse) {
|
||||
yield Left<Failure, Success>(GetOIDCConfigurationFromBaseUrlFailure(e));
|
||||
} else {
|
||||
yield Left<Failure, Success>(GetOIDCConfigurationFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user