authorization.adoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. = Authorization Migrations
  2. The following steps relate to how to finish migrating authorization support.
  3. == Use `AuthorizationManager` for Method Security
  4. There are no further migration steps for this feature.
  5. == Use `AuthorizationManager` for Message Security
  6. In 6.0, `<websocket-message-broker>` defaults `use-authorization-manager` to `true`.
  7. So, to complete migration, remove any `websocket-message-broker@use-authorization-manager=true` attribute.
  8. For example:
  9. [tabs]
  10. ======
  11. Xml::
  12. +
  13. [source,xml,role="primary"]
  14. ----
  15. <websocket-message-broker use-authorization-manager="true"/>
  16. ----
  17. ======
  18. changes to:
  19. [tabs]
  20. ======
  21. Xml::
  22. +
  23. [source,xml,role="primary"]
  24. ----
  25. <websocket-message-broker/>
  26. ----
  27. ======
  28. There are no further migrations steps for Java or Kotlin for this feature.
  29. == Use `AuthorizationManager` for Request Security
  30. In 6.0, `<http>` defaults `once-per-request` to `false`, `filter-all-dispatcher-types` to `true`, and `use-authorization-manager` to `true`.
  31. Also, xref:servlet/authorization/authorize-requests.adoc#filtersecurityinterceptor-every-request[`authorizeRequests#filterSecurityInterceptorOncePerRequest`] defaults to `false` and xref:servlet/authorization/authorize-http-requests.adoc[`authorizeHttpRequests#filterAllDispatcherTypes`] defaults to `true`.
  32. So, to complete migration, any defaults values can be removed.
  33. For example, if you opted in to the 6.0 default for `filter-all-dispatcher-types` or `authorizeHttpRequests#filterAllDispatcherTypes` like so:
  34. [tabs]
  35. ======
  36. Java::
  37. +
  38. [source,java,role="primary"]
  39. ----
  40. http
  41. .authorizeHttpRequests((authorize) -> authorize
  42. .filterAllDispatcherTypes(true)
  43. // ...
  44. )
  45. ----
  46. Kotlin::
  47. +
  48. [source,java,role="secondary"]
  49. ----
  50. http {
  51. authorizeHttpRequests {
  52. filterAllDispatcherTypes = true
  53. // ...
  54. }
  55. }
  56. ----
  57. Xml::
  58. +
  59. [source,xml,role="secondary"]
  60. ----
  61. <http use-authorization-manager="true" filter-all-dispatcher-types="true"/>
  62. ----
  63. ======
  64. then the defaults may be removed:
  65. [tabs]
  66. ======
  67. Java::
  68. +
  69. [source,java,role="primary"]
  70. ----
  71. http
  72. .authorizeHttpRequests((authorize) -> authorize
  73. // ...
  74. )
  75. ----
  76. Kotlin::
  77. +
  78. [source,java,role="secondary"]
  79. ----
  80. http {
  81. authorizeHttpRequests {
  82. // ...
  83. }
  84. }
  85. ----
  86. Xml::
  87. +
  88. [source,xml,role="secondary"]
  89. ----
  90. <http/>
  91. ----
  92. ======
  93. [NOTE]
  94. ====
  95. `once-per-request` applies only when `use-authorization-manager="false"` and `filter-all-dispatcher-types` only applies when `use-authorization-manager="true"`
  96. ====