zoukankan      html  css  js  c++  java
  • boke练习: @PreAuthorize authentication.name.equals的数据绑定与验证

    boke练习: @PreAuthorize authentication.name.equals的数据绑定与验证

    先看2个简单的例子:

    @PostMapping("/{username}/post")
    	@PreAuthorize("authentication.name.equals(#categoryVO.username)")
    	public ResponseEntity<Response> saveCategory(
    			@RequestBody CategoryVO categoryVO
    	)
    	{
      。。。。。。。。。。。。。。。。。。。。。
    }
    

      

    @PostMapping("/{username}/post")
    	@PreAuthorize("authentication.name.equals(#username)")
    	public ResponseEntity<Response> saveCategory(
    			@PathVariable("username") String username
    	)
    	{
    。。。。。。。。。。
    }
    

      

    从2个例子中我们可以看出,如果要使用@PreAuthorize的authentication.name.equals判断,那么在public定义的方法中一定要有数据接收类型(如:String username,CategoryVO categoryVO)username,categoryVO,只有这个2个数据是能直接在authentication.name.equals中使用的.

  • 相关阅读:
    学习《MYSQL》课程,日期2017.4.25-2017.4.30
    Netty学习笔记
    WebSocket学习
    Class 泛型
    SAX解析与DOM解析
    HashMap和HashTable的区别
    SQL语句整理
    观察者模式学习
    状态模式学习
    策略模式学习
  • 原文地址:https://www.cnblogs.com/achengmu/p/9868978.html
Copyright © 2011-2022 走看看