| 34554 |
tejus.loha |
1 |
package com.smartdukaan.cron.config;
|
|
|
2 |
|
|
|
3 |
import org.springframework.context.annotation.Configuration;
|
|
|
4 |
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
5 |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
|
6 |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
|
7 |
|
|
|
8 |
@Configuration
|
|
|
9 |
@EnableWebSecurity
|
|
|
10 |
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
11 |
@Override
|
|
|
12 |
protected void configure(HttpSecurity http) throws Exception {
|
|
|
13 |
http
|
|
|
14 |
.authorizeRequests()
|
|
|
15 |
.antMatchers("/expose", "/actuator/prometheus", "/public").permitAll() // Allow access to specific URLs
|
|
|
16 |
.anyRequest().authenticated() // Secure all other requests
|
|
|
17 |
.and()
|
|
|
18 |
.csrf().disable(); // Disable CSRF protection if necessary
|
|
|
19 |
}
|
|
|
20 |
}
|