Rename OIDC to OAuth. (#5525)

* Rename OIDC to OAuth.

* Update the enterprise submodule.
This commit is contained in:
Doug
2026-05-05 14:07:06 +01:00
committed by GitHub
parent e371903204
commit 0acbc41432
57 changed files with 402 additions and 400 deletions
@@ -96,7 +96,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
private let stateMachine: StateMachine<State, Event>
private var cancellables = Set<AnyCancellable>()
private var oidcPresenter: OIDCAuthenticationPresenter?
private var oAuthPresenter: OAuthAuthenticationPresenter?
// periphery:ignore - retaining purpose
private var bugReportFlowCoordinator: BugReportFlowCoordinator?
@@ -151,7 +151,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
}
func clearRoute(animated: Bool) {
oidcPresenter?.cancel() // Handle ongoing OIDC authentication first.
oAuthPresenter?.cancel() // Handle ongoing OAuth authentication first.
switch stateMachine.state {
case .initial, .startScreen:
@@ -175,13 +175,13 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
}
}
func handleOIDCRedirectURL(_ url: URL) {
guard let oidcPresenter else {
MXLog.error("Failed to find an OIDC request in progress.")
func handleOAuthCallbackURL(_ url: URL) {
guard let oAuthPresenter else {
MXLog.error("Failed to find an OAuth request in progress.")
return
}
oidcPresenter.handleUniversalLinkCallback(url)
oAuthPresenter.handleUniversalLinkCallback(url)
}
// MARK: - Setup
@@ -247,8 +247,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
// Completion
stateMachine.addRoutes(event: .signedIn, transitions: [.qrCodeLoginScreen => .complete,
.serverConfirmationScreen => .complete, // OIDC authentication
.startScreen => .complete, // Direct OIDC authentication
.serverConfirmationScreen => .complete, // OAuth authentication
.startScreen => .complete, // Direct OAuth authentication
.loginScreen => .complete]) { [weak self] context in
guard let userSession = context.userInfo as? UserSessionProtocol else { fatalError("The user session wasn't included in the context") }
self?.userHasSignedIn(userSession: userSession)
@@ -300,8 +300,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
case .register:
stateMachine.tryEvent(.confirmServer(.register))
case .loginDirectlyWithOIDC(let oidcData, let window):
showOIDCAuthentication(oidcData: oidcData, presentationAnchor: window)
case .loginDirectlyWithOAuth(let oAuthData, let window):
showOAuthAuthentication(oAuthData: oAuthData, presentationAnchor: window)
case .loginDirectlyWithPassword(let loginHint):
stateMachine.tryEvent(.continueWithPassword, userInfo: loginHint)
@@ -335,8 +335,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
switch action {
case .startOver:
fatalError("QR code login shouldn't request to start over as it's handled within the screen.")
case .requestOIDCAuthorisation, .linkedDevice:
fatalError("QR code login shouldn't request an OIDC flow or link a device.")
case .requestOAuthAuthorisation, .linkedDevice:
fatalError("QR code login shouldn't request an OAuth flow or link a device.")
case .signInManually:
navigationStackCoordinator.setSheetCoordinator(nil)
stateMachine.tryEvent(.cancelledLoginWithQR)
@@ -374,8 +374,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
guard let self else { return }
switch action {
case .continueWithOIDC(let oidcData, let window):
showOIDCAuthentication(oidcData: oidcData, presentationAnchor: window)
case .continueWithOAuth(let oAuthData, let window):
showOAuthAuthentication(oAuthData: oAuthData, presentationAnchor: window)
case .continueWithPassword:
stateMachine.tryEvent(.continueWithPassword)
case .changeServer:
@@ -420,22 +420,22 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
/// **Note:** We have intentionally excluded this presentation from the state machine as it doesn't mutate our navigation stack and there
/// isn't a robust way to detect why the user returned to the app when the MAS URL directly opens an external app for authentication without
/// presenting a web authentication session.
private func showOIDCAuthentication(oidcData: OIDCAuthorizationDataProxy, presentationAnchor: UIWindow) {
let presenter = OIDCAuthenticationPresenter(authenticationService: authenticationService,
oidcRedirectURL: appSettings.oidcRedirectURL,
presentationAnchor: presentationAnchor,
appMediator: appMediator,
userIndicatorController: userIndicatorController)
oidcPresenter = presenter
private func showOAuthAuthentication(oAuthData: OAuthAuthorizationDataProxy, presentationAnchor: UIWindow) {
let presenter = OAuthAuthenticationPresenter(authenticationService: authenticationService,
redirectURL: appSettings.oAuthRedirectURL,
presentationAnchor: presentationAnchor,
appMediator: appMediator,
userIndicatorController: userIndicatorController)
oAuthPresenter = presenter
Task {
switch await presenter.authenticate(using: oidcData) {
switch await presenter.authenticate(using: oAuthData) {
case .success(let userSession):
stateMachine.tryEvent(.signedIn, userInfo: userSession)
case .failure:
break // Nothing to do, any alerts will be handled by the presenter.
}
oidcPresenter = nil
oAuthPresenter = nil
}
}
@@ -454,8 +454,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
switch action {
case .signedIn(let userSession):
stateMachine.tryEvent(.signedIn, userInfo: userSession)
case .configuredForOIDC:
// Pop back to the confirmation screen for OIDC login to continue.
case .configuredForOAuth:
// Pop back to the confirmation screen for OAuth login to continue.
navigationStackCoordinator.pop(animated: false)
}
}
@@ -174,7 +174,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
}
case .globalSearch:
presentGlobalSearch()
case .accountProvisioningLink, .oidcCallback, .settings, .chatBackupSettings, .call:
case .accountProvisioningLink, .oAuthCallback, .settings, .chatBackupSettings, .call:
break // These routes cannot be handled.
}
}
@@ -122,8 +122,8 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol {
guard let self else { return }
switch action {
case .requestOIDCAuthorisation(let url):
presentOIDCAuthorization(for: url)
case .requestOAuthAuthorisation(let url):
presentOAuthAuthorization(for: url)
case .requestPassword(let passwordPublisher):
stateMachine.tryEvent(.confirmPassword, userInfo: passwordPublisher)
case .cancel:
@@ -155,14 +155,14 @@ class EncryptionResetFlowCoordinator: FlowCoordinatorProtocol {
}
}
private var accountSettingsPresenter: OIDCAccountSettingsPresenter?
private func presentOIDCAuthorization(for url: URL) {
private var accountSettingsPresenter: OAuthAccountSettingsPresenter?
private func presentOAuthAuthorization(for url: URL) {
// Note to anyone in the future if you come back here to make this open in Safari instead of a WAS.
// As of iOS 16, there is an issue on the simulator with accessing the cookie but it works on a device. 🤷‍♂️
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: url,
presentationAnchor: windowManager.mainWindow,
appMediator: appMediator,
appSettings: appSettings)
accountSettingsPresenter = OAuthAccountSettingsPresenter(accountURL: url,
presentationAnchor: windowManager.mainWindow,
appMediator: appMediator,
appSettings: appSettings)
accountSettingsPresenter?.start()
}
}
@@ -80,7 +80,7 @@ class EncryptionSettingsFlowCoordinator: FlowCoordinatorProtocol {
MXLog.info("Handling app route: \(appRoute)")
switch appRoute {
case .accountProvisioningLink, .oidcCallback:
case .accountProvisioningLink, .oAuthCallback:
break // We always ignore these flows when logged in.
case .roomList, .room, .roomAlias, .childRoom, .childRoomAlias,
.roomDetails, .roomMemberDetails, .userProfile, .thread,
@@ -9,7 +9,7 @@ import Combine
import Foundation
enum LinkNewDeviceFlowCoordinatorAction {
case requestOIDCAuthorisation(URL, OIDCAccountSettingsPresenter.Continuation)
case requestOAuthAuthorisation(URL, OAuthAccountSettingsPresenter.Continuation)
case dismiss
}
@@ -77,8 +77,8 @@ class LinkNewDeviceFlowCoordinator: FlowCoordinatorProtocol {
fatalError("QR linking shouldn't send sign-in actions.")
case .startOver:
navigationStackCoordinator.pop() // Pops back to the LinkNewDeviceScreen.
case .requestOIDCAuthorisation(let url, let continuation):
actionsSubject.send(.requestOIDCAuthorisation(url, continuation))
case .requestOAuthAuthorisation(let url, let continuation):
actionsSubject.send(.requestOAuthAuthorisation(url, continuation))
case .linkedDevice:
actionsSubject.send(.dismiss)
case .cancel:
@@ -201,7 +201,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
case .roomAlias, .childRoomAlias, .eventOnRoomAlias, .childEventOnRoomAlias:
break // These are converted to a room ID route one level above.
case .accountProvisioningLink, .oidcCallback, .roomList, .userProfile, .call, .settings, .chatBackupSettings, .globalSearch:
case .accountProvisioningLink, .oAuthCallback, .roomList, .userProfile, .call, .settings, .chatBackupSettings, .globalSearch:
break // These routes can't be handled.
case .transferOwnership(let roomID):
guard self.roomID == roomID else { fatalError("Navigation route doesn't belong to this room flow.") }
@@ -120,7 +120,7 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
}
case .roomAlias, .childRoomAlias, .eventOnRoomAlias, .childEventOnRoomAlias:
break // These are converted to a room ID route one level above.
case .accountProvisioningLink, .oidcCallback,
case .accountProvisioningLink, .oAuthCallback,
.roomList, .room, .roomDetails, .event,
.userProfile, .call, .settings, .chatBackupSettings,
.share, .transferOwnership, .thread, .globalSearch:
@@ -188,7 +188,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
switch action {
case .dismiss:
navigationStackCoordinator.setSheetCoordinator(nil)
case .requestOIDCAuthorisation(let url, let continuation):
case .requestOAuthAuthorisation(let url, let continuation):
presentAccountManagementURL(url, continuation: continuation)
}
}
@@ -295,17 +295,17 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
navigationStackCoordinator.push(coordinator)
}
// MARK: OIDC Account Management
// MARK: OAuth Account Management
private var accountSettingsPresenter: OIDCAccountSettingsPresenter?
private func presentAccountManagementURL(_ url: URL, continuation: OIDCAccountSettingsPresenter.Continuation? = nil) {
private var accountSettingsPresenter: OAuthAccountSettingsPresenter?
private func presentAccountManagementURL(_ url: URL, continuation: OAuthAccountSettingsPresenter.Continuation? = nil) {
// Note to anyone in the future if you come back here to make this open in Safari instead of a WAS.
// As of iOS 16, there is an issue on the simulator with accessing the cookie but it works on a device. 🤷‍♂️
accountSettingsPresenter = OIDCAccountSettingsPresenter(accountURL: url,
presentationAnchor: flowParameters.windowManager.mainWindow,
appMediator: flowParameters.appMediator,
appSettings: flowParameters.appSettings,
continuation: continuation)
accountSettingsPresenter = OAuthAccountSettingsPresenter(accountURL: url,
presentationAnchor: flowParameters.windowManager.mainWindow,
appMediator: flowParameters.appMediator,
appSettings: flowParameters.appSettings,
continuation: continuation)
accountSettingsPresenter?.start()
}
}
@@ -121,7 +121,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
MXLog.info("Handling app route: \(appRoute)")
switch appRoute {
case .accountProvisioningLink, .oidcCallback:
case .accountProvisioningLink, .oAuthCallback:
break // We always ignore these flows when logged in.
case .settings, .chatBackupSettings:
if ProcessInfo.processInfo.isiOSAppOnMac, flowParameters.windowManager.secondaryWindowsEnabled {