-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from collectiveidea/dependency-updates
Dependency updates; Ktor 3
- Loading branch information
Showing
4 changed files
with
11 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 2 additions & 11 deletions
13
runtime/src/commonMain/kotlin/com/collectiveidea/ktor/InvalidateBearerTokensDeclaration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
package com.collectiveidea.ktor | ||
|
||
import io.ktor.client.HttpClient | ||
import io.ktor.client.plugins.auth.Auth | ||
import io.ktor.client.plugins.auth.authProvider | ||
import io.ktor.client.plugins.auth.providers.BearerAuthProvider | ||
import io.ktor.client.plugins.plugin | ||
|
||
// Force the Auth plugin to invoke the `loadTokens` block again. | ||
// See: https://stackoverflow.com/q/72064782 and https://stackoverflow.com/a/67316630 | ||
// and https://youtrack.jetbrains.com/issue/KTOR-4759/Auth-BearerAuthProvider-caches-result-of-loadToken-until-process-death | ||
public fun HttpClient.invalidateBearerTokens() { | ||
try { | ||
plugin(Auth) | ||
.providers | ||
.filterIsInstance<BearerAuthProvider>() | ||
.first() | ||
.clearToken() | ||
} catch (e: IllegalStateException) { | ||
// No-op; plugin not installed | ||
} | ||
authProvider<BearerAuthProvider>()?.clearToken() | ||
} |
1 change: 0 additions & 1 deletion
1
runtime/src/commonTest/kotlin/com/collectiveidea/twirp/ErrorResponseTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters