Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open MAS Web page when logging out from other sessions on OIDC authenticated homeservers #7657

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,20 @@ - (void)showTrustForDevice:(MXDevice *)device
}

- (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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions changelog.d/7646.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You can now log out from other sessions using MAS on supported OIDC home servers.