Use new auth/revoke endpoint (#3416)

This commit is contained in:
Joris Pelgröm 2023-03-16 00:15:16 +01:00 committed by GitHub
parent 1a7091a761
commit 421f38f1c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 5 deletions

View file

@ -76,11 +76,18 @@ class AuthenticationRepositoryImpl @AssistedInject constructor(
Log.e(TAG, "Unable to revoke session.")
return
}
authenticationService.revokeToken(
url.newBuilder().addPathSegments("auth/token").build(),
server.session.refreshToken!!,
AuthenticationService.REVOKE_ACTION
)
if (server.version?.isAtLeast(2022, 9, 0) == true) {
authenticationService.revokeToken(
url.newBuilder().addPathSegments("auth/revoke").build(),
server.session.refreshToken!!
)
} else {
authenticationService.revokeTokenLegacy(
url.newBuilder().addPathSegments("auth/token").build(),
server.session.refreshToken!!,
AuthenticationService.REVOKE_ACTION
)
}
serverManager.updateServer(
server.copy(
session = server.session.copy(

View file

@ -38,6 +38,13 @@ interface AuthenticationService {
@FormUrlEncoded
@POST
suspend fun revokeToken(
@Url url: HttpUrl,
@Field("token") refreshToken: String
)
@FormUrlEncoded
@POST
suspend fun revokeTokenLegacy(
@Url url: HttpUrl,
@Field("token") refreshToken: String,
@Field("action") action: String