Created
February 9, 2018 22:55
-
-
Save bandrzejczak/1ffb9c3c1e5234e10e3c6bc622db7470 to your computer and use it in GitHub Desktop.
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
private def impersonateUser(token: String, userId: String): Future[Seq[(String, String)]] = { | |
sttp | |
.post(uri"${config.authServerUrl}/admin/realms/${config.realm}/users/$userId/impersonation") | |
.auth.bearer(token) | |
.send() | |
.map { r => | |
val currentTime = ZonedDateTime.now() | |
r.cookies | |
.filter(_.expires.forall(_.isAfter(currentTime))) | |
.map(cookie => (cookie.name, cookie.value)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment