Ejemplo n.º 1
0
 /**
  * 重新加载UserDetails
  *
  * @param username
  * @param request
  */
 public static void reloadUserDetails(String username, HttpServletRequest request) {
   UserDetailServiceImpl userDetailServiceImpl =
       ContextManager.getApplicationContext().getBean(UserDetailServiceImpl.class);
   UserDetails userDetails = userDetailServiceImpl.loadUserByUsername(username);
   PreAuthenticatedAuthenticationToken authentication =
       new PreAuthenticatedAuthenticationToken(
           userDetails, userDetails.getPassword(), userDetails.getAuthorities());
   if (request != null) {
     authentication.setDetails(new WebAuthenticationDetails(request));
   }
   SecurityContextHolder.getContext().setAuthentication(authentication);
 }
Ejemplo n.º 2
0
 public static DataSource getDataSource() {
   return (DataSource) ContextManager.getApplicationContext().getBean("dataSource");
 }
Ejemplo n.º 3
0
 public static PostSearchService getPostSearchService() {
   return ContextManager.getApplicationContext().getBean(PostSearchService.class);
 }
Ejemplo n.º 4
0
 public static JdbcTemplate getJdbcTemplate() {
   return ContextManager.getApplicationContext().getBean(JdbcTemplate.class);
 }
Ejemplo n.º 5
0
 public static ExtendsFreeMarkerConfigurer getExtendsFreeMarkerConfigurer() {
   return ContextManager.getApplicationContext().getBean(ExtendsFreeMarkerConfigurer.class);
 }
Ejemplo n.º 6
0
 public static FileService getFileService() {
   return ContextManager.getApplicationContext().getBean(FileService.class);
 }
Ejemplo n.º 7
0
 public static StatService getStatService() {
   return ContextManager.getApplicationContext().getBean(StatService.class);
 }
Ejemplo n.º 8
0
 public static CommentService getCommentService() {
   return ContextManager.getApplicationContext().getBean(CommentService.class);
 }
Ejemplo n.º 9
0
 public static CatalogService getCatalogService() {
   return ContextManager.getApplicationContext().getBean(CatalogService.class);
 }
Ejemplo n.º 10
0
 public static OptionService getOptionService() {
   return ContextManager.getApplicationContext().getBean(OptionService.class);
 }
Ejemplo n.º 11
0
 public static UserService getUserService() {
   return ContextManager.getApplicationContext().getBean(UserService.class);
 }