From 00ee61a2a08c9023db1ca2adc83446cae454c4fd Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 1 Jun 2021 12:11:49 +0200 Subject: [PATCH] stable ids for MSC 2858 --- .../android/sdk/api/auth/data/SsoIdentityProvider.kt | 12 ++++++------ .../matrix/android/sdk/internal/auth/Constants.kt | 1 - .../internal/auth/DefaultAuthenticationService.kt | 4 +--- .../sdk/internal/auth/data/LoginFlowResponse.kt | 2 +- newsfragment/3442.bugfix | 1 + 5 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 newsfragment/3442.bugfix diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/data/SsoIdentityProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/data/SsoIdentityProvider.kt index 64b3e180aa..a0733dda97 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/data/SsoIdentityProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/data/SsoIdentityProvider.kt @@ -51,12 +51,12 @@ data class SsoIdentityProvider( ) : Parcelable, Comparable { companion object { - const val BRAND_GOOGLE = "org.matrix.google" - const val BRAND_GITHUB = "org.matrix.github" - const val BRAND_APPLE = "org.matrix.apple" - const val BRAND_FACEBOOK = "org.matrix.facebook" - const val BRAND_TWITTER = "org.matrix.twitter" - const val BRAND_GITLAB = "org.matrix.gitlab" + const val BRAND_GOOGLE = "google" + const val BRAND_GITHUB = "github" + const val BRAND_APPLE = "apple" + const val BRAND_FACEBOOK = "facebook" + const val BRAND_TWITTER = "twitter" + const val BRAND_GITLAB = "gitlab" } override fun compareTo(other: SsoIdentityProvider): Int { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/Constants.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/Constants.kt index e0c52cf9ca..3742a429d2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/Constants.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/Constants.kt @@ -33,7 +33,6 @@ internal const val REGISTER_FALLBACK_PATH = "/_matrix/static/client/register/" * Ref: https://matrix.org/docs/spec/client_server/latest#sso-client-login */ internal const val SSO_REDIRECT_PATH = "/_matrix/client/r0/login/sso/redirect" -internal const val MSC2858_SSO_REDIRECT_PATH = "/_matrix/client/unstable/org.matrix.msc2858/login/sso/redirect" internal const val SSO_REDIRECT_URL_PARAM = "redirectUrl" diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt index 46256f4b81..20ce438d8e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt @@ -88,11 +88,9 @@ internal class DefaultAuthenticationService @Inject constructor( return buildString { append(homeServerUrlBase) + append(SSO_REDIRECT_PATH) if (providerId != null) { - append(MSC2858_SSO_REDIRECT_PATH) append("/$providerId") - } else { - append(SSO_REDIRECT_PATH) } // Set the redirect url appendParamToUrl(SSO_REDIRECT_URL_PARAM, redirectUrl) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/LoginFlowResponse.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/LoginFlowResponse.kt index d0d17e2cd5..c718fae390 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/LoginFlowResponse.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/LoginFlowResponse.kt @@ -42,7 +42,7 @@ internal data class LoginFlow( * the client can show a button for each of the supported providers * See MSC #2858 */ - @Json(name = "org.matrix.msc2858.identity_providers") + @Json(name = "identity_providers") val ssoIdentityProvider: List? = null ) diff --git a/newsfragment/3442.bugfix b/newsfragment/3442.bugfix new file mode 100644 index 0000000000..5a2d08ec18 --- /dev/null +++ b/newsfragment/3442.bugfix @@ -0,0 +1 @@ +Switch to stable endpoint/fields for MSC2858 \ No newline at end of file