Skip to content

Instantly share code, notes, and snippets.

@Tonel
Last active January 18, 2021 19:30
Show Gist options
  • Select an option

  • Save Tonel/e1493db088d1439a5843f97c1c9ab2e9 to your computer and use it in GitHub Desktop.

Select an option

Save Tonel/e1493db088d1439a5843f97c1c9ab2e9 to your computer and use it in GitHub Desktop.
@Component
class AuthTokenHandler {
@Autowired
private lateinit var tokenAPIHandler: TokenAPI
fun getUserFromToken(token : String?) : User {
if (token == null)
throw AuthenticationException()
try {
return tokenAPIHandler.getUserByToken(token)
} catch (e: Exception) {
throw AuthenticationException()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment