正在显示
3 个修改的文件
包含
34 行增加
和
10 行删除
| @@ -22,10 +22,10 @@ spring: | @@ -22,10 +22,10 @@ spring: | ||
| 22 | default-property-inclusion: ALWAYS | 22 | default-property-inclusion: ALWAYS |
| 23 | time-zone: GMT+8 | 23 | time-zone: GMT+8 |
| 24 | date-format: yyyy-MM-dd | 24 | date-format: yyyy-MM-dd |
| 25 | - # security: | ||
| 26 | - # user: | ||
| 27 | - # name: admin | ||
| 28 | - # password: 123456 | 25 | + security: |
| 26 | + user: | ||
| 27 | + name: admin | ||
| 28 | + password: 123456 | ||
| 29 | # \u94FE\u8DEF\u8FFD\u8E2A\u914D\u7F6E | 29 | # \u94FE\u8DEF\u8FFD\u8E2A\u914D\u7F6E |
| 30 | zipkin: | 30 | zipkin: |
| 31 | base-url: http://192.168.1.63:9411 | 31 | base-url: http://192.168.1.63:9411 |
| @@ -55,10 +55,10 @@ eureka: | @@ -55,10 +55,10 @@ eureka: | ||
| 55 | prefer-ip-address: true | 55 | prefer-ip-address: true |
| 56 | instance-id: ${spring.cloud.client.ip-address}:${server.port} | 56 | instance-id: ${spring.cloud.client.ip-address}:${server.port} |
| 57 | hostname: ${spring.cloud.client.ip-address} | 57 | hostname: ${spring.cloud.client.ip-address} |
| 58 | - # metadata-map: | ||
| 59 | - # user: | ||
| 60 | - # name: "admin" | ||
| 61 | - # passwoed: "123456" | 58 | + metadata-map: |
| 59 | + user: | ||
| 60 | + name: "admin" | ||
| 61 | + passwoed: "123456" | ||
| 62 | client: | 62 | client: |
| 63 | healthcheck: | 63 | healthcheck: |
| 64 | enabled: true | 64 | enabled: true |
| @@ -41,10 +41,10 @@ | @@ -41,10 +41,10 @@ | ||
| 41 | <!-- SpringBoot end --> | 41 | <!-- SpringBoot end --> |
| 42 | 42 | ||
| 43 | <!-- Security start --> | 43 | <!-- Security start --> |
| 44 | - <!--<dependency> | 44 | + <dependency> |
| 45 | <groupId>org.springframework.boot</groupId> | 45 | <groupId>org.springframework.boot</groupId> |
| 46 | <artifactId>spring-boot-starter-security</artifactId> | 46 | <artifactId>spring-boot-starter-security</artifactId> |
| 47 | - </dependency>--> | 47 | + </dependency> |
| 48 | <!-- Security end --> | 48 | <!-- Security end --> |
| 49 | 49 | ||
| 50 | <!-- SpringCloud start --> | 50 | <!-- SpringCloud start --> |
| 1 | +package com.sunyo.wlpt.cgonms.provide.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 | +/** | ||
| 9 | + * @author 子诚 | ||
| 10 | + * Description:SpringSecurity 权限配置框架 | ||
| 11 | + * 时间:2020/6/8 18:42 | ||
| 12 | + */ | ||
| 13 | +@EnableWebSecurity | ||
| 14 | +@Configuration | ||
| 15 | +public class SecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 16 | + @Override | ||
| 17 | + protected void configure(HttpSecurity http) throws Exception { | ||
| 18 | + http.authorizeRequests() | ||
| 19 | + .antMatchers("/","/exit/**","/cgoNms/**","/ws/**") | ||
| 20 | + .permitAll() | ||
| 21 | + .and() | ||
| 22 | + .csrf().disable(); | ||
| 23 | + } | ||
| 24 | +} |
-
请 注册 或 登录 后发表评论