Skip to content

Instantly share code, notes, and snippets.

@bandrzejczak
Created February 9, 2018 22:57
Show Gist options
  • Save bandrzejczak/0665c2ac2964db0df40b39c3b4fb98dd to your computer and use it in GitHub Desktop.
Save bandrzejczak/0665c2ac2964db0df40b39c3b4fb98dd to your computer and use it in GitHub Desktop.
def impersonate(username: String): Future[(String, Duration)] = {
for {
impersonatorToken <- obtainImpersonatorToken()
userId <- getUserId(username, impersonatorToken)
impersonatedUserCookies <- impersonateUser(impersonatorToken, userId)
userTokenAndTtl <- obtainTokenBasedOnIdentity(impersonatedUserCookies)
} yield userTokenAndTtl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment