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
@@ -46,7 +46,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOAuth }
context.send(viewAction: .confirm)
try await deferred.fulfill()
@@ -54,7 +54,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(service.homeserver.value.loginMode == .oAuth(supportsCreatePrompt: true))
}
@Test
@@ -65,13 +65,13 @@ final class ServerConfirmationScreenViewModelTests {
Issue.record("The configuration should succeed.")
return
}
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(service.homeserver.value.loginMode == .oAuth(supportsCreatePrompt: true))
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOAuth }
context.send(viewAction: .confirm)
try await deferred.fulfill()
@@ -91,7 +91,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOAuth }
context.send(viewAction: .confirm)
try await deferred.fulfill()
@@ -100,7 +100,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
// The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429
// #expect(client.urlForOauthOauthConfigurationPromptReceivedArguments?.prompt == .create)
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(service.homeserver.value.loginMode == .oAuth(supportsCreatePrompt: true))
}
@Test
@@ -111,13 +111,13 @@ final class ServerConfirmationScreenViewModelTests {
Issue.record("The configuration should succeed.")
return
}
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(service.homeserver.value.loginMode == .oAuth(supportsCreatePrompt: true))
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOAuth }
context.send(viewAction: .confirm)
try await deferred.fulfill()
@@ -130,8 +130,8 @@ final class ServerConfirmationScreenViewModelTests {
@Test
func confirmPasswordLoginWithoutConfiguration() async throws {
// Given a view model for login using a service that hasn't been configured (against a server that doesn't support OIDC).
setupViewModel(authenticationFlow: .login, supportsOIDC: false)
// Given a view model for login using a service that hasn't been configured (against a server that doesn't support OAuth).
setupViewModel(authenticationFlow: .login, supportsOAuth: false)
#expect(service.homeserver.value.loginMode == .unknown)
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
@@ -142,7 +142,7 @@ final class ServerConfirmationScreenViewModelTests {
context.send(viewAction: .confirm)
try await deferred.fulfill()
// Then a call to configure service should be made, but not for the OIDC URL.
// Then a call to configure service should be made, but not for the OAuth URL.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
#expect(service.homeserver.value.loginMode == .password)
@@ -151,7 +151,7 @@ final class ServerConfirmationScreenViewModelTests {
@Test
func confirmPasswordLoginAfterConfiguration() async throws {
// Given a view model for login using a service that has already been configured (via the server selection screen).
setupViewModel(authenticationFlow: .login, supportsOIDC: false)
setupViewModel(authenticationFlow: .login, supportsOAuth: false)
guard case .success = await service.configure(for: viewModel.state.homeserverAddress, flow: .login) else {
Issue.record("The configuration should succeed.")
return
@@ -166,7 +166,7 @@ final class ServerConfirmationScreenViewModelTests {
context.send(viewAction: .confirm)
try await deferred.fulfill()
// Then the configured homeserver should be used and no additional client should be built, nor a call to get the OIDC URL.
// Then the configured homeserver should be used and no additional client should be built, nor a call to get the OAuth URL.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
}
@@ -175,7 +175,7 @@ final class ServerConfirmationScreenViewModelTests {
func registrationNotSupportedAlert() async throws {
// Given a view model for registration using a service that hasn't been configured and the default server doesn't support registration.
// Note: We don't currently take the create prompt into account when determining registration support.
setupViewModel(authenticationFlow: .register, supportsOIDC: false, supportsOIDCCreatePrompt: false)
setupViewModel(authenticationFlow: .register, supportsOAuth: false, supportsOAuthCreatePrompt: false)
#expect(service.homeserver.value.loginMode == .unknown)
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(context.alertInfo == nil)
@@ -193,7 +193,7 @@ final class ServerConfirmationScreenViewModelTests {
@Test
func loginNotSupportedAlert() async throws {
// Given a view model for login using a service that hasn't been configured and the default server doesn't support login.
setupViewModel(authenticationFlow: .login, supportsOIDC: false, supportsOIDCCreatePrompt: false, supportsPasswordLogin: false)
setupViewModel(authenticationFlow: .login, supportsOAuth: false, supportsOAuthCreatePrompt: false, supportsPasswordLogin: false)
#expect(service.homeserver.value.loginMode == .unknown)
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(context.alertInfo == nil)
@@ -211,7 +211,7 @@ final class ServerConfirmationScreenViewModelTests {
@Test
func elementProRequired() async throws {
// Given a view model for login using a service that hasn't been configured and the default server requires Element Pro.
setupViewModel(authenticationFlow: .login, supportsOIDC: false, supportsOIDCCreatePrompt: false, supportsPasswordLogin: false, requiresElementPro: true)
setupViewModel(authenticationFlow: .login, supportsOAuth: false, supportsOAuthCreatePrompt: false, supportsPasswordLogin: false, requiresElementPro: true)
#expect(service.homeserver.value.loginMode == .unknown)
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(context.alertInfo == nil)
@@ -238,7 +238,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOAuth }
context.send(viewAction: .confirm)
try await deferred.fulfill()
@@ -246,7 +246,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(service.homeserver.value.loginMode == .oAuth(supportsCreatePrompt: true))
}
@Test
@@ -257,13 +257,13 @@ final class ServerConfirmationScreenViewModelTests {
Issue.record("The configuration should succeed.")
return
}
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(service.homeserver.value.loginMode == .oAuth(supportsCreatePrompt: true))
#expect(context.viewState.mode == .picker(appSettings.accountProviders))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOAuth }
context.send(viewAction: .confirm)
try await deferred.fulfill()
@@ -275,8 +275,8 @@ final class ServerConfirmationScreenViewModelTests {
@Test
func pickerForPasswordLoginWithoutConfiguration() async throws {
// Given a view model for login using a service that hasn't been configured (against a server that doesn't support OIDC).
setupViewModel(authenticationFlow: .login, supportsOIDC: false, restrictedFlow: true)
// Given a view model for login using a service that hasn't been configured (against a server that doesn't support OAuth).
setupViewModel(authenticationFlow: .login, supportsOAuth: false, restrictedFlow: true)
#expect(service.homeserver.value.loginMode == .unknown)
#expect(context.viewState.mode == .picker(appSettings.accountProviders))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
@@ -287,7 +287,7 @@ final class ServerConfirmationScreenViewModelTests {
context.send(viewAction: .confirm)
try await deferred.fulfill()
// Then a call to configure service should be made, but not for the OIDC URL.
// Then a call to configure service should be made, but not for the OAuth URL.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
#expect(service.homeserver.value.loginMode == .password)
@@ -296,7 +296,7 @@ final class ServerConfirmationScreenViewModelTests {
@Test
func pickerForPasswordLoginAfterConfiguration() async throws {
// Given a view model for login using a service that has already been configured (via the server selection screen).
setupViewModel(authenticationFlow: .login, supportsOIDC: false, restrictedFlow: true)
setupViewModel(authenticationFlow: .login, supportsOAuth: false, restrictedFlow: true)
guard case .success = await service.configure(for: appSettings.accountProviders[0], flow: .login) else {
Issue.record("The configuration should succeed.")
return
@@ -311,7 +311,7 @@ final class ServerConfirmationScreenViewModelTests {
context.send(viewAction: .confirm)
try await deferred.fulfill()
// Then the configured homeserver should be used and no additional client should be built, nor a call to get the OIDC URL.
// Then the configured homeserver should be used and no additional client should be built, nor a call to get the OAuth URL.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
}
@@ -319,8 +319,8 @@ final class ServerConfirmationScreenViewModelTests {
// MARK: - Helpers
private func setupViewModel(authenticationFlow: AuthenticationFlow,
supportsOIDC: Bool = true,
supportsOIDCCreatePrompt: Bool = true,
supportsOAuth: Bool = true,
supportsOAuthCreatePrompt: Bool = true,
supportsPasswordLogin: Bool = true,
restrictedFlow: Bool = false,
requiresElementPro: Bool = false) {
@@ -330,7 +330,7 @@ final class ServerConfirmationScreenViewModelTests {
allowOtherAccountProviders: false,
hideBrandChrome: false,
pushGatewayBaseURL: appSettings.pushGatewayBaseURL,
oidcRedirectURL: appSettings.oidcRedirectURL,
oAuthRedirectURL: appSettings.oAuthRedirectURL,
websiteURL: appSettings.websiteURL,
logoURL: appSettings.logoURL,
copyrightURL: appSettings.copyrightURL,
@@ -350,8 +350,8 @@ final class ServerConfirmationScreenViewModelTests {
}
// Manually create a configuration as the default homeserver address setting is immutable.
client = ClientSDKMock(configuration: .init(oidcLoginURL: supportsOIDC ? "https://account.matrix.org/authorize" : nil,
supportsOIDCCreatePrompt: supportsOIDCCreatePrompt,
client = ClientSDKMock(configuration: .init(oAuthLoginURL: supportsOAuth ? "https://account.matrix.org/authorize" : nil,
supportsOAuthCreatePrompt: supportsOAuthCreatePrompt,
supportsPasswordLogin: supportsPasswordLogin,
elementWellKnown: requiresElementPro ? "{\"version\":1,\"enforce_element_pro\":true}" : nil))
let configuration = AuthenticationClientFactoryMock.Configuration(homeserverClients: ["matrix.org": client])
@@ -370,7 +370,7 @@ final class ServerConfirmationScreenViewModelTests {
appSettings: ServiceLocator.shared.settings,
userIndicatorController: UserIndicatorControllerMock())
// Add a fake window in order for the OIDC flow to continue
// Add a fake window in order for the OAuth flow to continue
viewModel.context.send(viewAction: .updateWindow(UIWindow()))
}
}
@@ -387,9 +387,9 @@ private extension ServerConfirmationScreenViewState {
}
private extension ServerConfirmationScreenViewModelAction {
var isContinueWithOIDC: Bool {
var isContinueWithOAuth: Bool {
switch self {
case .continueWithOIDC: true
case .continueWithOAuth: true
default: false
}
}