@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; }
@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; }