File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
core/src/main/kotlin/net/osable/core Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,20 @@ class SecurityConfiguration {
35
35
.anyRequest().authenticated()
36
36
37
37
}.csrf {
38
- // Configure CSRF token
39
- it.csrfTokenRepository(CookieCsrfTokenRepository .withHttpOnlyFalse())
38
+ // Configure CSRF token through a cookie
39
+ // Setting domain allows sending the cookie on that domain **and subdomains**
40
+ it.csrfTokenRepository(CookieCsrfTokenRepository ().apply {
41
+ setSecure(true )
42
+ setCookieHttpOnly(true )
43
+ setCookieDomain(" osable.net" )
44
+ })
40
45
}.oauth2Client()
41
46
42
47
43
48
http.exceptionHandling().accessDeniedHandler { request, response, accessDeniedException ->
44
49
println (" Access denied. Cause: ${accessDeniedException.cause} | Message: ${accessDeniedException.message} " )
45
50
accessDeniedException.printStackTrace()
46
- response.status = request.getErrorCode ()
51
+ response.status = HttpStatus . FORBIDDEN .value ()
47
52
}
48
53
49
54
http.cors().configurationSource {
You can’t perform that action at this time.
0 commit comments