@@ -0,0 +1,1680 @@
+package common.web.controller;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.context.support.MessageSourceAccessor;%0Aimport org.springframework.security.authentication.AnonymousAuthenticationToken;%0Aimport org.springframework.security.core.Authentication;%0Aimport org.springframework.security.core.SpringSecurityMessageSource;%0Aimport org.springframework.security.core.context.SecurityContext;%0Aimport org.springframework.security.core.context.SecurityContextHolder;%0Aimport org.springframework.security.core.userdetails.UserDetails;%0A%0Aimport common.service.utils.AbstractHelperClass;%0A%0Apublic abstract class AbstractSecurityController extends AbstractHelperClass %7B%0A%09%0A%09protected UserDetails getCurrentUserDetails()%7B%0A%09%09UserDetails ret = null;%0A%09%09// check if user is login%0A%09%09Authentication auth = SecurityContextHolder.getContext().getAuthentication();%0A%09%09if (!(auth instanceof AnonymousAuthenticationToken)) %7B%0A%09%09%09ret = (UserDetails) auth.getPrincipal();%0A%09%09%09%0A%09%09%7D%0A%09%09return ret;%0A%09%7D%0A%09%0A%09protected String getCurrentUserName() %7B%0A%09%09Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();%0A%09%09String username = %22%22;%0A%09%09if (principal instanceof UserDetails) %7B%0A%09%09%09username = ((UserDetails) principal).getUsername();%0A%09%09%7D else %7B%0A%09%09%09username = principal.toString();%0A%09%09%7D%0A%09%09return username;%0A%09%7D%0A%09%0A%09protected boolean isAuthenticated() %7B%0A%09%09SecurityContext securityContext = SecurityContextHolder.getContext();%0A%09%09Authentication authentication = securityContext.getAuthentication();%0A%09%09boolean isAuthenticated = !(authentication instanceof AnonymousAuthenticationToken)%0A%09%09%09%09&& authentication.isAuthenticated();%0A%09%09return isAuthenticated;%0A%09%7D%0A%09%0A%7D%0A

add AbstractSecurityController