Example #1
0
 @Transactional(readOnly = true)
 public String getCurrentUsername() {
   Subject subject = SecurityUtils.getSubject();
   if (subject != null) {
     Principal principal = (Principal) subject.getPrincipal();
     if (principal != null) {
       return principal.getUsername();
     }
   }
   return null;
 }
Example #2
0
 @Transactional(readOnly = true)
 public Admin getCurrent() {
   Subject subject = SecurityUtils.getSubject();
   if (subject != null) {
     Principal principal = (Principal) subject.getPrincipal();
     if (principal != null) {
       return adminDao.find(principal.getId());
     }
   }
   return null;
 }