Merge pull request #7657 from vector-im/mauroromito/mas_device_logout

Open MAS Web page when logging out from other sessions on OIDC authenticated homeservers
This commit is contained in:
Mauro
2023-08-28 10:05:02 +02:00
committed by GitHub
3 changed files with 25 additions and 1 deletions

View File

@@ -655,6 +655,20 @@ enum {
}
- (void)removeDevice
{
NSURL *logoutURL = [self.mainSession.homeserverWellknown.authentication getLogoutDeviceURLFromID:device.deviceId];
if (logoutURL)
{
[UIApplication.sharedApplication openURL:logoutURL options:@{} completionHandler:nil];
[self withdrawViewControllerAnimated:YES completion:nil];
}
else
{
[self removeDeviceThroughAPI];
}
}
-(void) removeDeviceThroughAPI
{
[self startActivityIndicator];
self.view.userInteractionEnabled = NO;

View File

@@ -123,7 +123,11 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable {
if sessionInfo.isCurrent {
self.showLogoutConfirmationForCurrentSession()
} else {
self.showLogoutConfirmation(for: [sessionInfo])
if let logoutURL = self.parameters.session.homeserverWellknown.authentication?.getLogoutDeviceURL(fromID: sessionInfo.id) {
self.openMasLogoutURL(logoutURL)
} else {
self.showLogoutConfirmation(for: [sessionInfo])
}
}
case let .showSessionStateInfo(sessionInfo):
self.showInfoSheet(parameters: .init(userSessionInfo: sessionInfo, parentSize: self.toPresentable().view.bounds.size))
@@ -182,6 +186,11 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable {
return UserOtherSessionsCoordinator(parameters: parameters)
}
private func openMasLogoutURL(_ url: URL) {
UIApplication.shared.open(url)
popToSessionsOverview()
}
/// Shows a confirmation dialog to the user to sign out of a session.
private func showLogoutConfirmation(for sessionInfos: [UserSessionInfo]) {
// Use a UIAlertController as we don't have confirmationDialog in SwiftUI on iOS 14.

1
changelog.d/7646.bugfix Normal file
View File

@@ -0,0 +1 @@
You can now log out from other sessions using MAS on supported OIDC home servers.