Esempio 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);
 }
Esempio n. 2
0
 public static DataSource getDataSource() {
   return (DataSource) ContextManager.getApplicationContext().getBean("dataSource");
 }
Esempio n. 3
0
 public static PostSearchService getPostSearchService() {
   return ContextManager.getApplicationContext().getBean(PostSearchService.class);
 }
Esempio n. 4
0
 public static JdbcTemplate getJdbcTemplate() {
   return ContextManager.getApplicationContext().getBean(JdbcTemplate.class);
 }
Esempio n. 5
0
 public static ExtendsFreeMarkerConfigurer getExtendsFreeMarkerConfigurer() {
   return ContextManager.getApplicationContext().getBean(ExtendsFreeMarkerConfigurer.class);
 }
Esempio n. 6
0
 public static FileService getFileService() {
   return ContextManager.getApplicationContext().getBean(FileService.class);
 }
Esempio n. 7
0
 public static StatService getStatService() {
   return ContextManager.getApplicationContext().getBean(StatService.class);
 }
Esempio n. 8
0
 public static CommentService getCommentService() {
   return ContextManager.getApplicationContext().getBean(CommentService.class);
 }
Esempio n. 9
0
 public static CatalogService getCatalogService() {
   return ContextManager.getApplicationContext().getBean(CatalogService.class);
 }
Esempio n. 10
0
 public static OptionService getOptionService() {
   return ContextManager.getApplicationContext().getBean(OptionService.class);
 }
Esempio n. 11
0
 public static UserService getUserService() {
   return ContextManager.getApplicationContext().getBean(UserService.class);
 }