Skip to content

Commit a564078

Browse files
authored
fix: fixed support for Spring EnableMethodSecurity (CP 23.3) (#15830)
* chore: Added support for Spring @EnableMethodSecurity
1 parent c5013f0 commit a564078

37 files changed

Lines changed: 1733 additions & 0 deletions

File tree

‎flow-tests/vaadin-spring-tests/pom.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@
309309
<module>test-spring-security-flow-contextpath</module>
310310
<module>test-spring-security-flow-urlmapping</module>
311311
<module>test-spring-security-flow-reverseproxy</module>
312+
<module>test-spring-security-flow-methodsecurity</module>
312313

313314
<module>test-spring-boot-only-prepare</module>
314315
<module>test-spring-white-list</module>
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>com.vaadin</groupId>
7+
<artifactId>vaadin-spring-tests</artifactId>
8+
<version>23.3-SNAPSHOT</version>
9+
</parent>
10+
<artifactId>test-spring-security-flow-methodsecurity</artifactId>
11+
<name>Vaadin Spring Security test for Enabled Method Security</name>
12+
<packaging>jar</packaging>
13+
<properties>
14+
<maven.deploy.skip>true</maven.deploy.skip>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>com.vaadin</groupId>
20+
<artifactId>vaadin-spring</artifactId>
21+
<version>${project.version}</version>
22+
</dependency>
23+
24+
<dependency>
25+
<groupId>com.vaadin</groupId>
26+
<artifactId>flow-server</artifactId>
27+
<version>${project.version}</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>com.vaadin</groupId>
31+
<artifactId>vaadin-dev-server</artifactId>
32+
<version>${project.version}</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>com.vaadin</groupId>
36+
<artifactId>vaadin-testbench-core</artifactId>
37+
<version>${testbench.version}</version>
38+
<scope>test</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.springframework.boot</groupId>
42+
<artifactId>spring-boot-starter-web</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.springframework.boot</groupId>
46+
<artifactId>spring-boot-devtools</artifactId>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-security</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.security</groupId>
54+
<artifactId>spring-security-config</artifactId>
55+
</dependency>
56+
<dependency>
57+
<groupId>com.vaadin</groupId>
58+
<artifactId>vaadin-test-spring-helpers</artifactId>
59+
<version>${project.version}</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>com.vaadin</groupId>
63+
<artifactId>vaadin-test-spring-helpers</artifactId>
64+
<version>${project.version}</version>
65+
<type>test-jar</type>
66+
<scope>test</scope>
67+
</dependency>
68+
69+
70+
<!-- Test components -->
71+
<dependency>
72+
<groupId>com.vaadin</groupId>
73+
<artifactId>vaadin-upload-flow</artifactId>
74+
<version>${component.version}</version>
75+
</dependency>
76+
<dependency>
77+
<groupId>com.vaadin</groupId>
78+
<artifactId>vaadin-upload-testbench</artifactId>
79+
<version>${component.version}</version>
80+
</dependency>
81+
<dependency>
82+
<groupId>com.vaadin</groupId>
83+
<artifactId>vaadin-notification-flow</artifactId>
84+
<version>${component.version}</version>
85+
</dependency>
86+
<dependency>
87+
<groupId>com.vaadin</groupId>
88+
<artifactId>vaadin-notification-testbench</artifactId>
89+
<version>${component.version}</version>
90+
</dependency>
91+
<dependency>
92+
<groupId>com.vaadin</groupId>
93+
<artifactId>vaadin-button-flow</artifactId>
94+
<version>${component.version}</version>
95+
</dependency>
96+
<dependency>
97+
<groupId>com.vaadin</groupId>
98+
<artifactId>vaadin-button-testbench</artifactId>
99+
<version>${component.version}</version>
100+
</dependency>
101+
<dependency>
102+
<groupId>com.vaadin</groupId>
103+
<artifactId>vaadin-text-field-flow</artifactId>
104+
<version>${component.version}</version>
105+
</dependency>
106+
<dependency>
107+
<groupId>com.vaadin</groupId>
108+
<artifactId>vaadin-text-field-testbench</artifactId>
109+
<version>${component.version}</version>
110+
</dependency>
111+
<dependency>
112+
<groupId>com.vaadin</groupId>
113+
<artifactId>vaadin-tabs-flow</artifactId>
114+
<version>${component.version}</version>
115+
</dependency>
116+
<dependency>
117+
<groupId>com.vaadin</groupId>
118+
<artifactId>vaadin-tabs-testbench</artifactId>
119+
<version>${component.version}</version>
120+
</dependency>
121+
<dependency>
122+
<groupId>com.vaadin</groupId>
123+
<artifactId>vaadin-app-layout-flow</artifactId>
124+
<version>${component.version}</version>
125+
</dependency>
126+
<dependency>
127+
<groupId>com.vaadin</groupId>
128+
<artifactId>vaadin-app-layout-testbench</artifactId>
129+
<version>${component.version}</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>com.vaadin</groupId>
133+
<artifactId>vaadin-ordered-layout-flow</artifactId>
134+
<version>${component.version}</version>
135+
</dependency>
136+
<dependency>
137+
<groupId>com.vaadin</groupId>
138+
<artifactId>vaadin-ordered-layout-testbench</artifactId>
139+
<version>${component.version}</version>
140+
</dependency>
141+
<dependency>
142+
<groupId>com.vaadin</groupId>
143+
<artifactId>vaadin-login-flow</artifactId>
144+
<version>${component.version}</version>
145+
</dependency>
146+
<dependency>
147+
<groupId>com.vaadin</groupId>
148+
<artifactId>vaadin-login-testbench</artifactId>
149+
<version>${component.version}</version>
150+
</dependency>
151+
<dependency>
152+
<groupId>com.vaadin</groupId>
153+
<artifactId>vaadin-dialog-flow</artifactId>
154+
<version>${component.version}</version>
155+
</dependency>
156+
<dependency>
157+
<groupId>com.vaadin</groupId>
158+
<artifactId>vaadin-dialog-testbench</artifactId>
159+
<version>${component.version}</version>
160+
</dependency>
161+
<dependency>
162+
<groupId>com.vaadin</groupId>
163+
<artifactId>vaadin-avatar-flow</artifactId>
164+
<version>${component.version}</version>
165+
</dependency>
166+
</dependencies>
167+
168+
<build>
169+
<defaultGoal>spring-boot:run</defaultGoal>
170+
<pluginManagement>
171+
<plugins>
172+
<plugin>
173+
<groupId>org.springframework.boot</groupId>
174+
<artifactId>spring-boot-maven-plugin</artifactId>
175+
<version>${spring.boot.version}</version>
176+
</plugin>
177+
</plugins>
178+
</pluginManagement>
179+
180+
<plugins>
181+
<plugin>
182+
<groupId>com.vaadin</groupId>
183+
<artifactId>flow-maven-plugin</artifactId>
184+
<version>${project.version}</version>
185+
<executions>
186+
<execution>
187+
<goals>
188+
<goal>prepare-frontend</goal>
189+
<goal>build-frontend</goal>
190+
</goals>
191+
</execution>
192+
</executions>
193+
</plugin>
194+
<plugin>
195+
<groupId>org.springframework.boot</groupId>
196+
<artifactId>spring-boot-maven-plugin</artifactId>
197+
<configuration>
198+
<jvmArguments>
199+
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=18888
200+
</jvmArguments>
201+
</configuration>
202+
<executions>
203+
<!-- start and stop application when running
204+
integration tests -->
205+
<execution>
206+
<id>pre-integration-test</id>
207+
<goals>
208+
<goal>start</goal>
209+
</goals>
210+
</execution>
211+
<execution>
212+
<id>post-integration-test</id>
213+
<goals>
214+
<goal>stop</goal>
215+
</goals>
216+
</execution>
217+
</executions>
218+
</plugin>
219+
<plugin>
220+
<groupId>org.apache.maven.plugins</groupId>
221+
<artifactId>maven-jar-plugin</artifactId>
222+
<version>3.0.2</version>
223+
<executions>
224+
<execution>
225+
<goals>
226+
<goal>test-jar</goal>
227+
</goals>
228+
</execution>
229+
</executions>
230+
</plugin>
231+
232+
<!-- unpack helpers so they are included in the generated test-jar -->
233+
<plugin>
234+
<groupId>org.apache.maven.plugins</groupId>
235+
<artifactId>maven-dependency-plugin</artifactId>
236+
<executions>
237+
<execution>
238+
<id>unpack</id>
239+
<phase>process-test-classes</phase>
240+
<goals>
241+
<goal>unpack</goal>
242+
</goals>
243+
<configuration>
244+
<artifactItems>
245+
<artifactItem>
246+
<groupId>com.vaadin</groupId>
247+
<artifactId>vaadin-test-spring-helpers</artifactId>
248+
<version>${project.version}</version>
249+
<type>test-jar</type>
250+
<outputDirectory>${project.build.directory}/test-classes</outputDirectory>
251+
</artifactItem>
252+
</artifactItems>
253+
</configuration>
254+
</execution>
255+
</executions>
256+
</plugin>
257+
</plugins>
258+
</build>
259+
260+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.vaadin.flow.spring.flowsecurity;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.context.annotation.Bean;
6+
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
7+
import org.springframework.security.crypto.password.PasswordEncoder;
8+
9+
@SpringBootApplication
10+
public class Application {
11+
12+
public static void main(String[] args) {
13+
SpringApplication.run(Application.class, args);
14+
}
15+
16+
@Bean
17+
public PasswordEncoder passwordEncoder() {
18+
return new BCryptPasswordEncoder();
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.vaadin.flow.spring.flowsecurity;
2+
3+
import com.vaadin.flow.component.page.AppShellConfigurator;
4+
import com.vaadin.flow.component.page.Push;
5+
import com.vaadin.flow.server.PWA;
6+
import com.vaadin.flow.theme.Theme;
7+
8+
@PWA(name = "Spring Security Helper Test Project", shortName = "SSH Test")
9+
@Theme("spring-security-test-app")
10+
@Push
11+
public class Configurator implements AppShellConfigurator {
12+
13+
}

0 commit comments

Comments
 (0)