authorization.adoc 1.0 KB

123456789101112131415161718192021222324
  1. = Authorization Changes
  2. The following sections relate to how to adapt to changes in the authorization support.
  3. == Method Security
  4. [[compile-with-parameters]]
  5. === Compile With `-parameters`
  6. Spring Framework 6.1 https://github.com/spring-projects/spring-framework/issues/29559[removes LocalVariableTableParameterNameDiscoverer].
  7. This affects how `@PreAuthorize` and other xref:servlet/authorization/method-security.adoc[method security] annotations will process parameter names.
  8. If you are using method security annotations with parameter names, for example:
  9. [source,java]
  10. .Method security annotation using `id` parameter name
  11. ----
  12. @PreAuthorize("@authz.checkPermission(#id, authentication)")
  13. public void doSomething(Long id) {
  14. // ...
  15. }
  16. ----
  17. You must compile with `-parameters` to ensure that the parameter names are available at runtime.
  18. For more information about this, please visit the https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#core-container[Upgrading to Spring Framework 6.1 page].