通过本文配置,会对actuator 除了health外的所有端点,开启用户名密码验证,对于自己开发的接口不会要求用户名密码验证。

 

版本:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.SR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

 

maven依赖:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>        

 

配置:

management:
  security:
    enabled: true
security:
  user:
    name: xxx
    password: xxx
  basic:
    enabled: false

 

相关文章:

  • 2021-06-10
  • 2021-09-24
  • 2022-02-04
  • 2022-02-27
  • 2022-12-23
  • 2021-09-26
猜你喜欢
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
  • 2021-06-25
  • 2021-11-01
  • 2021-06-02
相关资源
相似解决方案