Skip to content

Commit

Permalink
[#183682057][#183681883] Add security headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jstromsky committed Nov 7, 2022
1 parent 2e1e2fb commit b45f837
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ public DefaultJwtSecurityConfig(Converter<Jwt, ? extends AbstractAuthenticationT
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and()
.headers()
.frameOptions().deny()
.xssProtection().and()
.contentSecurityPolicy(
"default-src 'self'; " +
"style-src 'self'; " +
"font-src 'self'; " +
"script-src 'self';" +
"img-src 'self'; " +
"connect-src 'self';"
).and()
.and()
.authorizeRequests()
.antMatchers("/actuator/health", "/actuator/info", "/service-info").permitAll()
.antMatchers("/**")
Expand Down Expand Up @@ -160,6 +172,18 @@ protected static class WalletJwtSecurityConfig extends WebSecurityConfigurerAdap
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and()
.headers()
.frameOptions().deny()
.xssProtection().and()
.contentSecurityPolicy(
"default-src 'self'; " +
"style-src 'self'; " +
"font-src 'self'; " +
"script-src 'self';" +
"img-src 'self'; " +
"connect-src 'self';"
).and()
.and()
.authorizeRequests()
.antMatchers("/actuator/health", "/actuator/info", "/service-info").permitAll()
.antMatchers("/**")
Expand Down Expand Up @@ -239,6 +263,18 @@ protected static class BasicAuthSecurityConfig extends WebSecurityConfigurerAdap
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and()
.headers()
.frameOptions().deny()
.xssProtection().and()
.contentSecurityPolicy(
"default-src 'self'; " +
"style-src 'self'; " +
"font-src 'self'; " +
"script-src 'self';" +
"img-src 'self'; " +
"connect-src 'self';"
).and()
.and()
.authorizeRequests()
.antMatchers("/api/**")
.authenticated()
Expand Down

0 comments on commit b45f837

Please sign in to comment.