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