作者 王勇

忘记了安全认证,加上了springsecurity

... ... @@ -22,10 +22,10 @@ spring:
default-property-inclusion: ALWAYS
time-zone: GMT+8
date-format: yyyy-MM-dd
# security:
# user:
# name: admin
# password: 123456
security:
user:
name: admin
password: 123456
# \u94FE\u8DEF\u8FFD\u8E2A\u914D\u7F6E
zipkin:
base-url: http://192.168.1.63:9411
... ... @@ -55,10 +55,10 @@ eureka:
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
hostname: ${spring.cloud.client.ip-address}
# metadata-map:
# user:
# name: "admin"
# passwoed: "123456"
metadata-map:
user:
name: "admin"
passwoed: "123456"
client:
healthcheck:
enabled: true
... ...
... ... @@ -41,10 +41,10 @@
<!-- SpringBoot end -->
<!-- Security start -->
<!--<dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>-->
</dependency>
<!-- Security end -->
<!-- SpringCloud start -->
... ...
package com.sunyo.wlpt.cgonms.provide.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;
/**
* @author 子诚
* Description:SpringSecurity 权限配置框架
* 时间:2020/6/8 18:42
*/
@EnableWebSecurity
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/","/exit/**","/cgoNms/**","/ws/**")
.permitAll()
.and()
.csrf().disable();
}
}
... ...