RbasService.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //package com.yihu.jw.config.security;
  2. //
  3. //import com.yihu.base.security.rbas.IRbasService;
  4. //import org.springframework.security.core.Authentication;
  5. //import org.springframework.security.core.userdetails.UserDetails;
  6. //import org.springframework.stereotype.Service;
  7. //import org.springframework.util.AntPathMatcher;
  8. //
  9. //import javax.servlet.http.HttpServletRequest;
  10. //import java.util.HashSet;
  11. //import java.util.Set;
  12. //
  13. ///**
  14. // * Created by chenweida on 2017/12/5.
  15. // * 判断用户是否有权限访问该路径
  16. // */
  17. //@Service("rbasService")
  18. //public class RbasService implements IRbasService {
  19. //
  20. // private AntPathMatcher antPathMatcher = new AntPathMatcher();
  21. //
  22. //
  23. // @Override
  24. // public Boolean hasPerssion(HttpServletRequest request, Authentication authentication) {
  25. // Object principal = authentication.getPrincipal();
  26. // boolean hasPerssion = false;
  27. // if (principal instanceof UserDetails) {
  28. // //获取用户名字
  29. // String username = ((UserDetails) principal).getUsername();
  30. //
  31. //
  32. // //获取用户全部权限
  33. // Set<String> uris = new HashSet<>();
  34. // for (String uri : uris) {
  35. // if (antPathMatcher.match(uri, request.getRequestURI())) {
  36. // hasPerssion = true;
  37. // break;
  38. // }
  39. // }
  40. // }
  41. // return true;
  42. // // return hasPerssion;
  43. // }
  44. //
  45. // public Boolean hello() {
  46. // return true;
  47. // }
  48. //}