Skip to content

Commit 776c879

Browse files
committed
Added h2 support
1 parent dc30fb2 commit 776c879

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

session-handling-spring-security/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
<packaging>jar</packaging>
1313
<name>Session Handling - Spring Security</name>
1414

15-
<description>Session Handling with Spring Security sample project. Requires a system property (or environment
16-
variable or command line argument) named jasypt.encryptor.password with the value
17-
session-handling-spring-security present on startup. Start via the main method in the Application class. After
18-
launching, open the web application in your browser at http://localhost:8080.
15+
<description>Session Handling with Spring Security sample project. Start via the main method in the Application
16+
class. After launching, open the web application in your browser at http://localhost:8080.
1917
</description>
2018

2119
<properties>
@@ -35,10 +33,12 @@
3533
<groupId>org.springframework.boot</groupId>
3634
<artifactId>spring-boot-starter-data-jpa</artifactId>
3735
</dependency>
36+
<!--
3837
<dependency>
3938
<groupId>com.github.ulisesbocchio</groupId>
4039
<artifactId>jasypt-spring-boot-starter</artifactId>
4140
</dependency>
41+
-->
4242
<dependency>
4343
<groupId>org.webjars</groupId>
4444
<artifactId>bootstrap</artifactId>

session-handling-spring-security/src/main/java/de/dominikschadow/javasecurity/sessionhandling/config/WebSecurityConfig.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,19 @@ protected void configure(HttpSecurity http) throws Exception {
5353
// @formatter:off
5454
http
5555
.authorizeRequests()
56-
.antMatchers("/*").permitAll()
56+
.antMatchers("/*", "/h2-console/**").permitAll()
5757
.antMatchers("/user/**").hasAnyRole("USER", "ADMIN")
5858
.antMatchers("/admin/**").hasRole("ADMIN")
59-
.and()
60-
.formLogin()
61-
.and()
62-
.logout()
59+
.and()
60+
.csrf()
61+
.ignoringAntMatchers("/h2-console/*")
62+
.and()
63+
.headers()
64+
.frameOptions().sameOrigin()
65+
.and()
66+
.formLogin()
67+
.and()
68+
.logout()
6369
.logoutSuccessUrl("/")
6470
.permitAll();
6571
// @formatter:on
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
spring:
22
datasource:
3-
username: ses-han-spr-sec-admin
4-
password: ENC(9bjqRQFmO73Gj6gh+XVv3qv7IE7iBs76UGi8bWKLQyH4CoE+w6kUgg==)
3+
username: admin
4+
password: samplePassword
5+
name: session-handling
6+
h2:
7+
console:
8+
enabled: true

0 commit comments

Comments
 (0)