KaTool-Security
Home
GetStart
  • AuthCenter
  • 适配SpringCloudGateWay
  • 适配Zuul
  • 网关中间件更换适配方案
  • 插件化鉴权
  • 注解文档
  • Restful响应文档
  • 内部方法文档
  • Auth中心RPC调用接口文档
  • 1.1.0.RELEASE之前
  • 1.1.0.RELEASE新概念
  • 参与贡献
  • 未来规划
  • KaTool
  • KaToolTest
  • 在github上修改本页面
  • Karos'Blog
Home
GetStart
  • AuthCenter
  • 适配SpringCloudGateWay
  • 适配Zuul
  • 网关中间件更换适配方案
  • 插件化鉴权
  • 注解文档
  • Restful响应文档
  • 内部方法文档
  • Auth中心RPC调用接口文档
  • 1.1.0.RELEASE之前
  • 1.1.0.RELEASE新概念
  • 参与贡献
  • 未来规划
  • KaTool
  • KaToolTest
  • 在github上修改本页面
  • Karos'Blog
  • 启动Auth中心

进阶主要是对微服务项目的鉴权升级,不管是使用Spring Cloud GateWay作为网关,还是采用Zuul作为网关,都离不开鉴权中心

启动Auth中心

Auth中心的作用是起到从各个服务和网关之间的鉴权名单同步。

下载解压

首先到Release中下载katool-security-auth,解压即可

编写application.yml

进入./config文件夹,对application.yml进行配置,如果没有,那么创建一个

配置如下

spring:
  web:
    resources:
      static-locations: [ classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/ ]
  main:
    allow-bean-definition-overriding: true
  application:
    name: KaTool-Security-Auth
  # todo
  cloud:
    nacos:
      discovery:
        server-addr: 1自行配置
      config:
        username: nacos
        password: nacos
  # 默认 dev 环境
  profiles:
    active: dev
  # 支持 swagger3
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
  # session 配置
  session:
    # todo 取消注释开启分布式 session(须先配置 Redis)
    store-type: redis
    # 30 天过期
    timeout: 2592000
  # 数据库配置
  # todo
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/katool_security?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: # 自行填写
    password: # 自行填写

  # Redis 配置
    # todo
  redis:
    database: 0
    host:
    port:
    timeout: 5000
    password:
  servlet:
    multipart:
      location: /data/upload_tmp
# 大小限制
      max-file-size: 10GB
      max-request-size: 100GB
  aop:
    proxy-target-class: true
# MybatisPlus 配置
server:
  # todo 自行配置
  address: 0.0.0.0
  port: 7777
  servlet:
    # cookie 30 天过期
    session:
      cookie:
        max-age: 2592000
mybatis-plus:
  mapper-locations: classpath*:/mapper/**/*.xml
  configuration:
    map-underscore-to-camel-case: false
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  global-config:
    db-config:
      logic-delete-field: isDelete # 全局逻辑删除的实体字段名
      logic-delete-value: 1 # 逻辑已删除值(默认为 1)
      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
katool:
  security:
    mode: single	# 对于网关来说,只能选择单体模式,因为网关通常只进行转发
    core:
      token-header: "Authorization"
  util:
    redis:
      policy: caffeine
      time-unit: days
      exp-time: 7
  lock:
    internal-lock-lease-time: 30
    time-unit: minutes
dubbo:
  application:
    name: dubbo-KaTool-Security-Auth
  protocol:
    name: dubbo
    port: -1
  registry:
    id: nacos-registry
    address: nacos://localhost:8848 # todo: 自行配置

其中,标记了todo的都是需要自行配置的

项目启动

进入./bin/目录,选择startup.cmd进行启动

Last Updated:
Contributors: ZonglinWu