Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
the description for this gist
def verifyToken(token: String): Future[Option[AccessToken]] = {
val tokenVerifier = RSATokenVerifier.create(token).realmUrl(keycloakDeployment.getRealmInfoUrl)
for {
publicKey <- publicKeys.map(_.get(tokenVerifier.getHeader.getKeyId))
} yield publicKey match {
case Some(publicKey) =>
val token = tokenVerifier.publicKey(publicKey).verify().getToken
Some(token)
case None =>
log.warning(s"no public key found for id ${tokenVerifier.getHeader.getKeyId}")
None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.