TF-1289-PartII : Handle destroy subscription when logout OIDC
This commit is contained in:
@@ -72,14 +72,15 @@ abstract class ReloadableController extends BaseController {
|
|||||||
_handleGetSessionFailure();
|
_handleGetSessionFailure();
|
||||||
} else if (failure is LogoutOidcFailure) {
|
} else if (failure is LogoutOidcFailure) {
|
||||||
log('ReloadableController::onData(): LogoutOidcFailure: $failure');
|
log('ReloadableController::onData(): LogoutOidcFailure: $failure');
|
||||||
|
_getSubscriptionLocalAction();
|
||||||
} else if (failure is GetStoredTokenOidcFailure) {
|
} else if (failure is GetStoredTokenOidcFailure) {
|
||||||
_goToLogin(arguments: LoginArguments(LoginFormType.ssoForm));
|
_goToLogin(arguments: LoginArguments(LoginFormType.ssoForm));
|
||||||
} else if (failure is GetAuthenticatedAccountFailure || failure is NoAuthenticatedAccountFailure) {
|
} else if (failure is GetAuthenticatedAccountFailure || failure is NoAuthenticatedAccountFailure) {
|
||||||
_goToLogin(arguments: LoginArguments(LoginFormType.credentialForm));
|
_goToLogin(arguments: LoginArguments(LoginFormType.credentialForm));
|
||||||
} else if (failure is GetFCMSubscriptionLocalFailure) {
|
} else if (failure is GetFCMSubscriptionLocalFailure) {
|
||||||
logoutAction();
|
_checkAuthenticationTypeWhenLogout();
|
||||||
} else if (failure is DestroySubscriptionFailure) {
|
} else if (failure is DestroySubscriptionFailure) {
|
||||||
logoutAction();
|
_checkAuthenticationTypeWhenLogout();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(success) {
|
(success) {
|
||||||
@@ -88,14 +89,15 @@ abstract class ReloadableController extends BaseController {
|
|||||||
} else if (success is GetSessionSuccess) {
|
} else if (success is GetSessionSuccess) {
|
||||||
_handleGetSessionSuccess(success);
|
_handleGetSessionSuccess(success);
|
||||||
} else if (success is LogoutOidcSuccess) {
|
} else if (success is LogoutOidcSuccess) {
|
||||||
handleLogoutOidcSuccess(success);
|
log('ReloadableController::handleLogoutOidcSuccess(): $success');
|
||||||
|
_getSubscriptionLocalAction();
|
||||||
} else if (success is GetStoredTokenOidcSuccess) {
|
} else if (success is GetStoredTokenOidcSuccess) {
|
||||||
_handleGetStoredTokenOIDCSuccess(success);
|
_handleGetStoredTokenOIDCSuccess(success);
|
||||||
} else if (success is GetFCMSubscriptionLocalSuccess) {
|
} else if (success is GetFCMSubscriptionLocalSuccess) {
|
||||||
final _subscriptionId = success.fcmSubscription.subscriptionId;
|
final _subscriptionId = success.fcmSubscription.subscriptionId;
|
||||||
_destroySubscriptionAction(_subscriptionId);
|
_destroySubscriptionAction(_subscriptionId);
|
||||||
} else if (success is DestroySubscriptionSuccess) {
|
} else if (success is DestroySubscriptionSuccess) {
|
||||||
logoutAction();
|
_checkAuthenticationTypeWhenLogout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -165,25 +167,20 @@ abstract class ReloadableController extends BaseController {
|
|||||||
void handleReloaded(Session session) {}
|
void handleReloaded(Session session) {}
|
||||||
|
|
||||||
void logoutAction() async {
|
void logoutAction() async {
|
||||||
final authenticationType = _authorizationInterceptors.authenticationType;
|
await Future.wait([
|
||||||
if (authenticationType == AuthenticationType.oidc) {
|
_deleteCredentialInteractor.execute(),
|
||||||
consumeState(_logoutOidcInteractor.execute());
|
_cachingManager.clearAll(),
|
||||||
} else {
|
_languageCacheManager.removeLanguage(),
|
||||||
await Future.wait([
|
]);
|
||||||
_deleteCredentialInteractor.execute(),
|
_authorizationInterceptors.clear();
|
||||||
_cachingManager.clearAll(),
|
_authorizationIsolateInterceptors.clear();
|
||||||
_languageCacheManager.removeLanguage(),
|
_fcmReceiver.deleteFcmToken();
|
||||||
]);
|
await _cachingManager.closeHive();
|
||||||
_authorizationInterceptors.clear();
|
_goToLogin(arguments: LoginArguments(LoginFormType.credentialForm));
|
||||||
_authorizationIsolateInterceptors.clear();
|
|
||||||
_fcmReceiver.deleteFcmToken();
|
|
||||||
await _cachingManager.closeHive();
|
|
||||||
_goToLogin(arguments: LoginArguments(LoginFormType.credentialForm));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleLogoutOidcSuccess(LogoutOidcSuccess success) async {
|
void _logoutOIDCAction() async {
|
||||||
log('ReloadableController::handleLogoutOidcSuccess(): $success');
|
log('ReloadableController::_logoutOIDCAction():');
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
_deleteAuthorityOidcInteractor.execute(),
|
_deleteAuthorityOidcInteractor.execute(),
|
||||||
_cachingManager.clearAll(),
|
_cachingManager.clearAll(),
|
||||||
@@ -220,7 +217,7 @@ abstract class ReloadableController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getSubscriptionLocalAction() {
|
Future<void> _getSubscriptionLocalAction() {
|
||||||
try {
|
try {
|
||||||
_getSubscriptionLocalInteractor = Get.find<GetFCMSubscriptionLocalInteractor>();
|
_getSubscriptionLocalInteractor = Get.find<GetFCMSubscriptionLocalInteractor>();
|
||||||
consumeState(_getSubscriptionLocalInteractor!.execute());
|
consumeState(_getSubscriptionLocalInteractor!.execute());
|
||||||
@@ -259,8 +256,22 @@ abstract class ReloadableController extends BaseController {
|
|||||||
|
|
||||||
void logout(Session? session, AccountId? accountId) {
|
void logout(Session? session, AccountId? accountId) {
|
||||||
final _fcmEnabled = fcmEnabled(session, accountId);
|
final _fcmEnabled = fcmEnabled(session, accountId);
|
||||||
if (_fcmEnabled) {
|
if (_fcmEnabled) {
|
||||||
getSubscriptionLocalAction();
|
final authenticationType = _authorizationInterceptors.authenticationType;
|
||||||
|
if (authenticationType == AuthenticationType.oidc) {
|
||||||
|
consumeState(_logoutOidcInteractor.execute());
|
||||||
|
} else {
|
||||||
|
_getSubscriptionLocalAction();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_checkAuthenticationTypeWhenLogout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _checkAuthenticationTypeWhenLogout() {
|
||||||
|
final authenticationType = _authorizationInterceptors.authenticationType;
|
||||||
|
if (authenticationType == AuthenticationType.oidc) {
|
||||||
|
_logoutOIDCAction();
|
||||||
} else {
|
} else {
|
||||||
logoutAction();
|
logoutAction();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user