Merge pull request #2550 from vector-im/feature/bma/unstable_prefix

MSC2858 unstable prefix
This commit is contained in:
Benoit Marty 2020-12-17 19:09:12 +01:00 committed by GitHub
commit c48f153b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 8 deletions

View File

@ -8,7 +8,7 @@ Improvements 🙌:
- -
Bugfix 🐛: Bugfix 🐛:
- - Fix MSC2858 implementation details (#2540)
Translations 🗣: Translations 🗣:
- -

View File

@ -165,7 +165,7 @@ In this case, the user can click on "Sign in with SSO" and the native web browse
> https://homeserver.with.sso/_matrix/client/r0/login/sso/redirect?redirectUrl=element%3A%2F%element > https://homeserver.with.sso/_matrix/client/r0/login/sso/redirect?redirectUrl=element%3A%2F%element
The parameter `redirectUrl` is set to `element://element`. The parameter `redirectUrl` is set to `element://connect`.
ChromeCustomTabs are an intermediate way to display a WebPage, between a WebView and using the external browser. More info can be found [here](https://developer.chrome.com/multidevice/android/customtabs) ChromeCustomTabs are an intermediate way to display a WebPage, between a WebView and using the external browser. More info can be found [here](https://developer.chrome.com/multidevice/android/customtabs)
@ -175,7 +175,7 @@ During the process, user may be asked to validate an email by clicking on a link
Once the process is finished, the web page will call the `redirectUrl` with an extra parameter `loginToken` Once the process is finished, the web page will call the `redirectUrl` with an extra parameter `loginToken`
> element://element?loginToken=MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy > element://connect?loginToken=MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy
This navigation is intercepted by Element by the `LoginActivity`, which will then ask the homeserver to convert this `loginToken` to an access token This navigation is intercepted by Element by the `LoginActivity`, which will then ask the homeserver to convert this `loginToken` to an access token

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 * 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 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" 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 * the client can show a button for each of the supported providers
* See MSC #2858 * See MSC #2858
*/ */
@Json(name = "identity_providers") @Json(name = "org.matrix.msc2858.identity_providers")
val ssoIdentityProvider: List<SsoIdentityProvider>? val ssoIdentityProvider: List<SsoIdentityProvider>?
) )

View File

@ -95,8 +95,9 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="element" /> <data
<data android:host="element" /> android:host="connect"
android:scheme="element" />
</intent-filter> </intent-filter>
</activity> </activity>

View File

@ -23,6 +23,7 @@ import com.airbnb.mvrx.PersistState
import com.airbnb.mvrx.Success import com.airbnb.mvrx.Success
import com.airbnb.mvrx.Uninitialized import com.airbnb.mvrx.Uninitialized
import im.vector.app.core.extensions.appendParamToUrl import im.vector.app.core.extensions.appendParamToUrl
import org.matrix.android.sdk.api.auth.MSC2858_SSO_REDIRECT_PATH
import org.matrix.android.sdk.api.auth.SSO_REDIRECT_PATH import org.matrix.android.sdk.api.auth.SSO_REDIRECT_PATH
import org.matrix.android.sdk.api.auth.SSO_REDIRECT_URL_PARAM import org.matrix.android.sdk.api.auth.SSO_REDIRECT_URL_PARAM
@ -72,9 +73,11 @@ data class LoginViewState(
fun getSsoUrl(providerId: String?): String { fun getSsoUrl(providerId: String?): String {
return buildString { return buildString {
append(homeServerUrl?.trim { it == '/' }) append(homeServerUrl?.trim { it == '/' })
append(SSO_REDIRECT_PATH)
if (providerId != null) { if (providerId != null) {
append(MSC2858_SSO_REDIRECT_PATH)
append("/$providerId") append("/$providerId")
} else {
append(SSO_REDIRECT_PATH)
} }
// Set a redirect url we will intercept later // Set a redirect url we will intercept later
appendParamToUrl(SSO_REDIRECT_URL_PARAM, VECTOR_REDIRECT_URL) appendParamToUrl(SSO_REDIRECT_URL_PARAM, VECTOR_REDIRECT_URL)
@ -87,6 +90,6 @@ data class LoginViewState(
companion object { companion object {
// Note that the domain can be displayed to the user for confirmation that he trusts it. So use a human readable string // Note that the domain can be displayed to the user for confirmation that he trusts it. So use a human readable string
private const val VECTOR_REDIRECT_URL = "element://element" private const val VECTOR_REDIRECT_URL = "element://connect"
} }
} }