Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }