Make MSC2858 implementation match the unstable policy of the spec

See https://github.com/matrix-org/matrix-doc/pull/2858/files#r543567196
This commit is contained in:
Travis Ralston 2020-12-15 11:42:53 -07:00 committed by Benoit Marty
parent 6cdb192955
commit ea6fde3ed0
3 changed files with 5 additions and 2 deletions

View File

@ -33,5 +33,6 @@ const val REGISTER_FALLBACK_PATH = "/_matrix/static/client/register/"
* Ref: https://matrix.org/docs/spec/client_server/latest#sso-client-login
*/
const val SSO_REDIRECT_PATH = "/_matrix/client/r0/login/sso/redirect"
const val MSC2858_SSO_REDIRECT_PATH = "/_matrix/client/unstable/org.matrix.msc2858/login/sso/redirect"
const val SSO_REDIRECT_URL_PARAM = "redirectUrl"

View File

@ -42,6 +42,6 @@ internal data class LoginFlow(
* the client can show a button for each of the supported providers
* See MSC #2858
*/
@Json(name = "identity_providers")
@Json(name = "org.matrix.msc2858.identity_providers")
val ssoIdentityProvider: List<SsoIdentityProvider>?
)

View File

@ -72,9 +72,11 @@ data class LoginViewState(
fun getSsoUrl(providerId: String?): String {
return buildString {
append(homeServerUrl?.trim { it == '/' })
append(SSO_REDIRECT_PATH)
if (providerId != null) {
append(MSC2858_SSO_REDIRECT_PATH)
append("/$providerId")
} else {
append(SSO_REDIRECT_PATH)
}
// Set a redirect url we will intercept later
appendParamToUrl(SSO_REDIRECT_URL_PARAM, VECTOR_REDIRECT_URL)