Created
December 30, 2017 15:47
-
-
Save balvinder294/af9dcc465809ceda94777e48545a6022 to your computer and use it in GitHub Desktop.
Use this code to get User details in jhipster
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
# If you are looking for the current User's infos, the one who's currently connected : | |
final String userLogin = SecurityUtils.getCurrentUserLogin(); | |
will get you, by definition, the current user login, then : | |
Optional<User> currentUser = userRepository.findOneByLogin(userLogin); | |
will get you the entity User linked to the login, from which you can access all information with | |
currentUser.get().getEmail() for example |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment