Merge branch '2.5.x' into 2.6.x
Closes gh-30346
This commit is contained in:
@@ -337,7 +337,31 @@ You can customize the console's path by using the configprop:spring.h2.console.p
|
||||
|
||||
|
||||
|
||||
[[data.sql.jooq]]
|
||||
[[data.sql.h2-web-console.spring-security]]
|
||||
==== Accessing the H2 Console in a Secured Application
|
||||
H2 Console uses frames and, as it is intended for development only, does not implement CSRF protection measures.
|
||||
If your application uses Spring Security, you need to configure it to
|
||||
|
||||
* disable CSRF protection for requests against the console,
|
||||
* set the header `X-Frame-Options` to `SAMEORIGIN` on responses from the console.
|
||||
|
||||
More information on {spring-security-docs}#csrf[CSRF] and the header {spring-security-docs}#headers-frame-options[X-Frame-Options] can be found in the Spring Security Reference Guide.
|
||||
|
||||
In simple setups, a `SecurityFilterChain` like the following can be used:
|
||||
|
||||
[source,java,indent=0,subs="verbatim"]
|
||||
----
|
||||
include::{docs-java}/features/sql/h2webconsole/springsecurity/DevProfileSecurityConfiguration.java[]
|
||||
----
|
||||
|
||||
WARNING: The H2 console is only intended for use during development.
|
||||
In production, disabling CSRF protection or allowing frames for a website may create severe security risks.
|
||||
|
||||
TIP: `PathRequest.toH2Console()` returns the correct request matcher also when the console's path has been customized.
|
||||
|
||||
|
||||
|
||||
[[features.sql.jooq]]
|
||||
=== Using jOOQ
|
||||
jOOQ Object Oriented Querying (https://www.jooq.org/[jOOQ]) is a popular product from https://www.datageekery.com/[Data Geekery] which generates Java code from your database and lets you build type-safe SQL queries through its fluent API.
|
||||
Both the commercial and open source editions can be used with Spring Boot.
|
||||
|
||||
Reference in New Issue
Block a user