zoukankan      html  css  js  c++  java
  • 开启spring boot actuator 安全认证

    通过本文配置,会对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
  • 相关阅读:
    上传文件
    Python中@staticmethod和@classmethod的作用和区别
    面向对象 类
    成员修饰符
    class 类 笔记
    模块&包
    java 文件上传下载
    redis 基本操作命令
    redis 和 mysql 的主从复制
    mysql的日志文件及其作用
  • 原文地址:https://www.cnblogs.com/flying607/p/8796751.html
Copyright © 2011-2022 走看看