Rename OIDC components and variables to OAuth (#6686)
* Rename `OIDC` components and variables to `OAuth`. This matches the new behavior in the SDK.
This commit is contained in:
parent
7dd81dc838
commit
367995303d
96 changed files with 479 additions and 482 deletions
|
|
@ -26,7 +26,7 @@ import io.element.android.libraries.matrix.api.media.MatrixMediaLoader
|
|||
import io.element.android.libraries.matrix.api.media.MediaPreviewService
|
||||
import io.element.android.libraries.matrix.api.notification.NotificationService
|
||||
import io.element.android.libraries.matrix.api.notificationsettings.NotificationSettingsService
|
||||
import io.element.android.libraries.matrix.api.oidc.AccountManagementAction
|
||||
import io.element.android.libraries.matrix.api.oauth.AccountManagementAction
|
||||
import io.element.android.libraries.matrix.api.pusher.PushersService
|
||||
import io.element.android.libraries.matrix.api.room.BaseRoom
|
||||
import io.element.android.libraries.matrix.api.room.JoinedRoom
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ sealed class AuthenticationException(message: String?) : Exception(message) {
|
|||
class InvalidServerName(message: String?) : AuthenticationException(message)
|
||||
class SlidingSyncVersion(message: String?) : AuthenticationException(message)
|
||||
class ServerUnreachable(message: String?) : AuthenticationException(message)
|
||||
class Oidc(message: String?) : AuthenticationException(message)
|
||||
class OAuth(message: String?) : AuthenticationException(message)
|
||||
class Generic(message: String?) : AuthenticationException(message)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ interface MatrixAuthenticationService {
|
|||
suspend fun importCreatedSession(externalSession: ExternalSession): Result<SessionId>
|
||||
|
||||
/*
|
||||
* OIDC part.
|
||||
* OAuth part.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the Oidc url to display to the user.
|
||||
* Get the OAuth url to display to the user.
|
||||
*/
|
||||
suspend fun getOidcUrl(
|
||||
prompt: OidcPrompt,
|
||||
suspend fun getOAuthUrl(
|
||||
prompt: OAuthPrompt,
|
||||
loginHint: String?,
|
||||
): Result<OidcDetails>
|
||||
): Result<OAuthDetails>
|
||||
|
||||
/**
|
||||
* Cancel Oidc login sequence.
|
||||
* Cancel OAuth login sequence.
|
||||
*/
|
||||
suspend fun cancelOidcLogin(): Result<Unit>
|
||||
suspend fun cancelOAuthLogin(): Result<Unit>
|
||||
|
||||
/**
|
||||
* Set the existing data about Element Classic session, if any.
|
||||
|
|
@ -68,9 +68,9 @@ interface MatrixAuthenticationService {
|
|||
): Boolean
|
||||
|
||||
/**
|
||||
* Attempt to login using the [callbackUrl] provided by the Oidc page.
|
||||
* Attempt to log in using the [callbackUrl] provided by the OAuth page.
|
||||
*/
|
||||
suspend fun loginWithOidc(callbackUrl: String): Result<SessionId>
|
||||
suspend fun loginWithOAuth(callbackUrl: String): Result<SessionId>
|
||||
|
||||
suspend fun loginWithQrCode(qrCodeData: MatrixQrCodeLoginData, progress: (QrCodeLoginStep) -> Unit): Result<SessionId>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ package io.element.android.libraries.matrix.api.auth
|
|||
data class MatrixHomeServerDetails(
|
||||
val url: String,
|
||||
val supportsPasswordLogin: Boolean,
|
||||
val supportsOidcLogin: Boolean,
|
||||
val supportsOAuthLogin: Boolean,
|
||||
) {
|
||||
val isSupported = supportsPasswordLogin || supportsOidcLogin
|
||||
val isSupported = supportsPasswordLogin || supportsOAuthLogin
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ package io.element.android.libraries.matrix.api.auth
|
|||
|
||||
import io.element.android.libraries.matrix.api.BuildConfig
|
||||
|
||||
object OidcConfig {
|
||||
object OAuthConfig {
|
||||
const val CLIENT_URI = BuildConfig.CLIENT_URI
|
||||
|
||||
// Note: host must match with the host of CLIENT_URI
|
||||
|
|
@ -12,6 +12,6 @@ import android.os.Parcelable
|
|||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class OidcDetails(
|
||||
data class OAuthDetails(
|
||||
val url: String,
|
||||
) : Parcelable
|
||||
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.auth
|
||||
|
||||
sealed interface OidcPrompt {
|
||||
sealed interface OAuthPrompt {
|
||||
/**
|
||||
* The Authorization Server should prompt the End-User for
|
||||
* reauthentication.
|
||||
*/
|
||||
data object Login : OidcPrompt
|
||||
data object Login : OAuthPrompt
|
||||
|
||||
/**
|
||||
* The Authorization Server should prompt the End-User to create a user
|
||||
|
|
@ -21,10 +21,10 @@ sealed interface OidcPrompt {
|
|||
*
|
||||
* Defined in [Initiating User Registration via OpenID Connect](https://openid.net/specs/openid-connect-prompt-create-1_0.html).
|
||||
*/
|
||||
data object Create : OidcPrompt
|
||||
data object Create : OAuthPrompt
|
||||
|
||||
/**
|
||||
* An unknown value.
|
||||
*/
|
||||
data class Unknown(val value: String) : OidcPrompt
|
||||
data class Unknown(val value: String) : OAuthPrompt
|
||||
}
|
||||
|
|
@ -8,6 +8,6 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.auth
|
||||
|
||||
interface OidcRedirectUrlProvider {
|
||||
interface OAuthRedirectUrlProvider {
|
||||
fun provide(): String
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ sealed class QrLoginException : Exception() {
|
|||
data object Expired : QrLoginException()
|
||||
data object NotFound : QrLoginException()
|
||||
data object LinkingNotSupported : QrLoginException()
|
||||
data object OidcMetadataInvalid : QrLoginException()
|
||||
data object OAuthMetadataInvalid : QrLoginException()
|
||||
data object SlidingSyncNotAvailable : QrLoginException()
|
||||
data object OtherDeviceNotSignedIn : QrLoginException()
|
||||
data object CheckCodeAlreadySent : QrLoginException()
|
||||
|
|
|
|||
|
|
@ -112,19 +112,19 @@ interface IdentityPasswordResetHandle : IdentityResetHandle {
|
|||
}
|
||||
|
||||
/**
|
||||
* A handle to reset the user's identity with an OIDC login type.
|
||||
* A handle to reset the user's identity with an OAuth login type.
|
||||
*/
|
||||
interface IdentityOidcResetHandle : IdentityResetHandle {
|
||||
interface IdentityOAuthResetHandle : IdentityResetHandle {
|
||||
/**
|
||||
* The URL to open in a webview/custom tab to reset the identity.
|
||||
*/
|
||||
val url: String
|
||||
|
||||
/**
|
||||
* Reset the identity using the OIDC flow.
|
||||
* Reset the identity using the OAuth flow.
|
||||
*
|
||||
* This method will block the coroutine it's running on and keep polling indefinitely until either the coroutine is cancelled, the [cancel] method is
|
||||
* called, or the identity is reset.
|
||||
*/
|
||||
suspend fun resetOidc(): Result<Unit>
|
||||
suspend fun resetOAuth(): Result<Unit>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.oidc
|
||||
package io.element.android.libraries.matrix.api.oauth
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.DeviceId
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ class MatrixHomeServerDetailsTest {
|
|||
@Test
|
||||
fun `if homeserver supports oidc, then it is supported`() {
|
||||
val sut = aMatrixHomeServerDetails(
|
||||
supportsOidcLogin = true,
|
||||
supportsOAuthLogin = true,
|
||||
supportsPasswordLogin = false,
|
||||
)
|
||||
assertThat(sut.isSupported).isTrue()
|
||||
|
|
@ -25,7 +25,7 @@ class MatrixHomeServerDetailsTest {
|
|||
@Test
|
||||
fun `if homeserver supports password, then it is supported`() {
|
||||
val sut = aMatrixHomeServerDetails(
|
||||
supportsOidcLogin = false,
|
||||
supportsOAuthLogin = false,
|
||||
supportsPasswordLogin = true,
|
||||
)
|
||||
assertThat(sut.isSupported).isTrue()
|
||||
|
|
@ -34,7 +34,7 @@ class MatrixHomeServerDetailsTest {
|
|||
@Test
|
||||
fun `if homeserver supports both, then it is supported`() {
|
||||
val sut = aMatrixHomeServerDetails(
|
||||
supportsOidcLogin = true,
|
||||
supportsOAuthLogin = true,
|
||||
supportsPasswordLogin = true,
|
||||
)
|
||||
assertThat(sut.isSupported).isTrue()
|
||||
|
|
@ -43,7 +43,7 @@ class MatrixHomeServerDetailsTest {
|
|||
@Test
|
||||
fun `if homeserver supports none, then it is not supported`() {
|
||||
val sut = aMatrixHomeServerDetails(
|
||||
supportsOidcLogin = false,
|
||||
supportsOAuthLogin = false,
|
||||
supportsPasswordLogin = false,
|
||||
)
|
||||
assertThat(sut.isSupported).isFalse()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue