You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for Custom Authorization Rules and Disabling Features in Vaadin Security (#4485) (#4519)
Summary
This PR adds detailed for two key sections in Vaadin Security configuration:
Custom Authorization Rules – explains what they are, their use cases, and how they complement Vaadin's annotation-based view access control.
Disabling Features – explains the default behavior of CSRF configuration and Navigation Access Control in VaadinSecurityConfigurer, and when it is safe to disable them.
Co-authored-by: Fred Peña <f.ant.pena@gmail.com>
Co-authored-by: Petter Holmström <petter@vaadin.com>
Copy file name to clipboardExpand all lines: articles/flow/security/vaadin-security-configurer.adoc
+50-1Lines changed: 50 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -298,6 +298,19 @@ public class SecurityConfig {
298
298
299
299
===== Custom Authorization Rules
300
300
301
+
In Spring Security, *Custom Authorization Rules* are developer-defined rules that control who can access certain HTTP routes or resources. In Vaadin, they complement the access control already applied to views through annotations like `@PermitAll` or `@RolesAllowed`.
302
+
303
+
====== Use Cases
304
+
305
+
- Protect REST endpoints that are not part of Vaadin navigation.
306
+
- Define public routes that don’t require authentication (`/public/**`).
307
+
- Restrict specific areas based on roles (`/admin-only/**`).
308
+
- Allow access to error pages without authentication (`/error`).
309
+
310
+
====== How It Works With Vaadin
311
+
312
+
Vaadin uses annotations to control access to views at the navigation level, while Spring Security applies these *Custom Authorization Rules* at the HTTP request level. Both layers work together to ensure a secure application.
313
+
301
314
[source,java]
302
315
----
303
316
@Configuration
@@ -327,6 +340,42 @@ public class SecurityConfig {
327
340
328
341
===== Disabling Features
329
342
343
+
The `VaadinSecurityConfigurer` provides some security features enabled by
344
+
default to ensure smooth integration between Vaadin and Spring Security.
345
+
In certain scenarios, you may disable these defaults to apply your own
0 commit comments