Last active
January 18, 2021 19:30
-
-
Save Tonel/e1493db088d1439a5843f97c1c9ab2e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @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