Skip to content

Commit 476e48d

Browse files
committed
Add missing tests and Javadoc from token refresh/revoke
1 parent 753cba2 commit 476e48d

2 files changed

Lines changed: 303 additions & 265 deletions

File tree

‎matrix-sdk-core/src/main/java/io/github/hikingc/matrixsdk/api/MatrixOAuth.java‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,12 @@ public TokenMetadata attemptRefreshToken(TokenMetadata tokenMetadata) {
308308
return Mapper.getObjectFromInputStream(refreshRes, TokenMetadata.class);
309309
}
310310

311+
/// Attempts to revoke tokens.
312+
///
313+
/// @param tokenMetadata either a previous [TokenMetadata] from a refresh or the data received
314+
/// from [#performOAuthLogin(String, int, String, BrowserLauncher)]
315+
/// @param cliendId optional client identifier to aid in the auditory of revokation. Revocation will be performed regardless of input
316+
/// @see <a href="https://datatracker.ietf.org/doc/html/rfc7009">RFC 7009.</a>
311317
public void attemptRevokeToken(TokenMetadata tokenMetadata, @Nullable String cliendId) {
312318
String accessToken = tokenMetadata.accessToken();
313319
var metadata = this.getAuthMetadata();
@@ -318,7 +324,7 @@ public void attemptRevokeToken(TokenMetadata tokenMetadata, @Nullable String cli
318324
//noinspection EmptyTryBlock
319325
try (var _ =
320326
httpTransport.postAuth(
321-
URI.create(metadata.revocationEndpoint() + "/oauth2/revoke"), body)) {
327+
URI.create(metadata.revocationEndpoint().toString()), body)) {
322328
// do nothing
323329
} catch (Exception e) {
324330
throw new MatrixException("Revoke token failed.", e);

0 commit comments

Comments
 (0)