Skip to content

Commit

Permalink
updated security config
Browse files Browse the repository at this point in the history
  • Loading branch information
xpinjection committed Sep 15, 2023
1 parent 4aa86ea commit e3917b2
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;

import static org.springframework.security.config.Customizer.withDefaults;

@Configuration
@RequiredArgsConstructor
public class ActuatorBasicSecurityConfig {
Expand All @@ -19,13 +22,9 @@ public SecurityFilterChain filterChain(HttpSecurity http, WebEndpointProperties
.requestMatchers(actuatorBasePath + "/**").hasRole("ADMIN")
.requestMatchers("/**").permitAll()
.anyRequest().authenticated())
.httpBasic()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.csrf()
.disable()
.httpBasic(withDefaults())
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(AbstractHttpConfigurer::disable)
.build();
}
}

0 comments on commit e3917b2

Please sign in to comment.