|
@@ -0,0 +1,24 @@
|
|
|
+package com.diagbot.config;
|
|
|
+
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
|
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @author: gaodm
|
|
|
+ * @time: 2022/4/11 17:24
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+@EnableWebSecurity
|
|
|
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void configure(HttpSecurity http) throws Exception {
|
|
|
+ // 关闭csrf
|
|
|
+ http.csrf().disable();
|
|
|
+ // 支持httpBasic
|
|
|
+ http.authorizeRequests().anyRequest().authenticated().and().httpBasic();
|
|
|
+ }
|
|
|
+}
|