Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 7a96a73

Browse files
committed
Add real tests in security-thymeleaf sample
1 parent 4c59fe2 commit 7a96a73

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

samples/security-thymeleaf/src/main/java/com/example/securitythymeleaf/WebSecurityConfig.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
1818
@Override
1919
protected void configure(HttpSecurity http) throws Exception {
2020
http
21-
.authorizeRequests(authorize -> authorize
22-
.antMatchers("/").permitAll()
23-
.anyRequest().authenticated()
24-
)
21+
.authorizeRequests(authorize -> authorize
22+
.antMatchers("/").permitAll()
23+
.anyRequest().authenticated()
24+
)
25+
.httpBasic().and()
2526
.formLogin(withDefaults());
2627
}
2728

samples/security-thymeleaf/verify.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
#!/usr/bin/env bash
22
source ${PWD%/*samples/*}/scripts/wait.sh
33
wait_log target/native/test-output.txt "Started SecurityThymeleafApplication"
4+
wait_http localhost:8080/ "Welcome!" || RC=$?
5+
wait_http user:password@localhost:8080/hello "Hello <span>user</span>" || RC=$?
6+
wait_command_output 'curl -s -I localhost:8080/hello' "HTTP/1.1 401" || RC=$?
7+
8+
exit $RC

0 commit comments

Comments
 (0)