mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Rename OIDC to OAuth. (#5525)
* Rename OIDC to OAuth. * Update the enterprise submodule.
This commit is contained in:
+3
-3
@@ -17,7 +17,7 @@ enum MockSoftLogoutScreenState: String, CaseIterable {
|
||||
// mock that screen.
|
||||
case emptyPassword
|
||||
case enteredPassword
|
||||
case oidc
|
||||
case oAuth
|
||||
case unsupported
|
||||
case keyBackupNeeded
|
||||
|
||||
@@ -37,9 +37,9 @@ enum MockSoftLogoutScreenState: String, CaseIterable {
|
||||
homeserver: .mockBasicServer,
|
||||
keyBackupNeeded: false,
|
||||
password: "12345678")
|
||||
case .oidc:
|
||||
case .oAuth:
|
||||
return SoftLogoutScreenViewModel(credentials: credentials,
|
||||
homeserver: .mockOIDC,
|
||||
homeserver: .mockOAuth,
|
||||
keyBackupNeeded: false)
|
||||
case .unsupported:
|
||||
return SoftLogoutScreenViewModel(credentials: credentials,
|
||||
|
||||
+21
-21
@@ -46,7 +46,7 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
||||
parameters.authenticationService
|
||||
}
|
||||
|
||||
private var oidcPresenter: OIDCAuthenticationPresenter?
|
||||
private var oAuthPresenter: OAuthAuthenticationPresenter?
|
||||
|
||||
var actions: AnyPublisher<SoftLogoutScreenCoordinatorResult, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
@@ -76,8 +76,8 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
||||
showForgotPasswordScreen()
|
||||
case .clearAllData:
|
||||
actionsSubject.send(.clearAllData)
|
||||
case .continueWithOIDC:
|
||||
continueWithOIDC(presentationAnchor: viewModel.context.viewState.window)
|
||||
case .continueWithOAuth:
|
||||
continueWithOAuth(presentationAnchor: viewModel.context.viewState.window)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
@@ -91,13 +91,13 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
||||
AnyView(SoftLogoutScreen(context: viewModel.context))
|
||||
}
|
||||
|
||||
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: - Private
|
||||
@@ -143,32 +143,32 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
private func continueWithOIDC(presentationAnchor: UIWindow?) {
|
||||
private func continueWithOAuth(presentationAnchor: UIWindow?) {
|
||||
guard let presentationAnchor else { return }
|
||||
|
||||
startLoading()
|
||||
|
||||
Task {
|
||||
switch await authenticationService.urlForOIDCLogin(loginHint: nil) {
|
||||
switch await authenticationService.urlForOAuthLogin(loginHint: nil) {
|
||||
case .failure(let error):
|
||||
stopLoading()
|
||||
handleError(error)
|
||||
case .success(let oidcData):
|
||||
case .success(let oAuthData):
|
||||
stopLoading()
|
||||
|
||||
let presenter = OIDCAuthenticationPresenter(authenticationService: parameters.authenticationService,
|
||||
oidcRedirectURL: parameters.appSettings.oidcRedirectURL,
|
||||
presentationAnchor: presentationAnchor,
|
||||
appMediator: parameters.appMediator,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
self.oidcPresenter = presenter
|
||||
switch await presenter.authenticate(using: oidcData) {
|
||||
let presenter = OAuthAuthenticationPresenter(authenticationService: parameters.authenticationService,
|
||||
redirectURL: parameters.appSettings.oAuthRedirectURL,
|
||||
presentationAnchor: presentationAnchor,
|
||||
appMediator: parameters.appMediator,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
self.oAuthPresenter = presenter
|
||||
switch await presenter.authenticate(using: oAuthData) {
|
||||
case .success(let userSession):
|
||||
actionsSubject.send(.signedIn(userSession))
|
||||
case .failure(let error):
|
||||
handleError(error)
|
||||
}
|
||||
self.oidcPresenter = nil
|
||||
self.oAuthPresenter = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,10 +180,10 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
||||
viewModel.displayError(.alert(L10n.screenLoginErrorInvalidCredentials))
|
||||
case .accountDeactivated:
|
||||
viewModel.displayError(.alert(L10n.screenLoginErrorDeactivatedAccount))
|
||||
case .oidcError(.notSupported):
|
||||
// Temporary alert hijacking the use of .notSupported, can be removed when OIDC support is in the SDK.
|
||||
case .oAuthError(.notSupported):
|
||||
// Temporary alert hijacking the use of .notSupported, can be removed when OAuth support is in the SDK.
|
||||
viewModel.displayError(.alert(L10n.commonServerNotSupported))
|
||||
case .oidcError(.userCancellation):
|
||||
case .oAuthError(.userCancellation):
|
||||
// No need to show an error, the user cancelled authentication.
|
||||
break
|
||||
case .sessionTokenRefreshNotSupported:
|
||||
|
||||
+8
-8
@@ -22,8 +22,8 @@ enum SoftLogoutScreenViewModelAction: CustomStringConvertible {
|
||||
case forgotPassword
|
||||
/// Clear all user data
|
||||
case clearAllData
|
||||
/// Continue using OIDC.
|
||||
case continueWithOIDC
|
||||
/// Continue using OAuth.
|
||||
case continueWithOAuth
|
||||
|
||||
/// A string representation of the result, ignoring any associated values that could leak PII.
|
||||
var description: String {
|
||||
@@ -34,8 +34,8 @@ enum SoftLogoutScreenViewModelAction: CustomStringConvertible {
|
||||
return "forgotPassword"
|
||||
case .clearAllData:
|
||||
return "clearAllData"
|
||||
case .continueWithOIDC:
|
||||
return "continueWithOIDC"
|
||||
case .continueWithOAuth:
|
||||
return "continueWithOAuth"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ struct SoftLogoutScreenViewState: BindableState {
|
||||
homeserver.loginMode
|
||||
}
|
||||
|
||||
/// The presentation anchor used for OIDC authentication.
|
||||
/// The presentation anchor used for OAuth authentication.
|
||||
var window: UIWindow?
|
||||
|
||||
/// Whether to show recover encryption keys message
|
||||
@@ -80,7 +80,7 @@ struct SoftLogoutScreenBindings {
|
||||
}
|
||||
|
||||
enum SoftLogoutScreenViewAction {
|
||||
/// Updates the window used as the OIDC presentation anchor.
|
||||
/// Updates the window used as the OAuth presentation anchor.
|
||||
case updateWindow(UIWindow?)
|
||||
/// Login.
|
||||
case login
|
||||
@@ -88,8 +88,8 @@ enum SoftLogoutScreenViewAction {
|
||||
case forgotPassword
|
||||
/// Clear all user data.
|
||||
case clearAllData
|
||||
/// Continue using OIDC.
|
||||
case continueWithOIDC
|
||||
/// Continue using OAuth.
|
||||
case continueWithOAuth
|
||||
}
|
||||
|
||||
enum SoftLogoutScreenErrorType: Hashable {
|
||||
|
||||
+2
-2
@@ -38,8 +38,8 @@ class SoftLogoutScreenViewModel: SoftLogoutScreenViewModelType, SoftLogoutScreen
|
||||
actionsSubject.send(.forgotPassword)
|
||||
case .clearAllData:
|
||||
actionsSubject.send(.clearAllData)
|
||||
case .continueWithOIDC:
|
||||
actionsSubject.send(.continueWithOIDC)
|
||||
case .continueWithOAuth:
|
||||
actionsSubject.send(.continueWithOAuth)
|
||||
case .updateWindow(let window):
|
||||
guard state.window != window else { return }
|
||||
Task { state.window = window }
|
||||
|
||||
+6
-6
@@ -26,8 +26,8 @@ struct SoftLogoutScreen: View {
|
||||
switch context.viewState.loginMode {
|
||||
case .password:
|
||||
loginForm
|
||||
case .oidc:
|
||||
oidcButton
|
||||
case .oAuth:
|
||||
oAuthButton
|
||||
default:
|
||||
loginUnavailableText
|
||||
}
|
||||
@@ -98,15 +98,15 @@ struct SoftLogoutScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// The OIDC button that can be used for login.
|
||||
var oidcButton: some View {
|
||||
Button { context.send(viewAction: .continueWithOIDC) } label: {
|
||||
/// The OAuth button that can be used for login.
|
||||
var oAuthButton: some View {
|
||||
Button { context.send(viewAction: .continueWithOAuth) } label: {
|
||||
Text(L10n.actionContinue)
|
||||
}
|
||||
.buttonStyle(.compound(.primary))
|
||||
}
|
||||
|
||||
/// Text shown if neither password or OIDC login is supported.
|
||||
/// Text shown if neither password or OAuth login is supported.
|
||||
var loginUnavailableText: some View {
|
||||
Text(L10n.screenLoginErrorUnsupportedAuthentication)
|
||||
.font(.body)
|
||||
|
||||
Reference in New Issue
Block a user