当前位置: 首页 > news >正文

缩短网址做钓鱼网站广州推广优化

缩短网址做钓鱼网站,广州推广优化,qq说说赞在线自助下单网站,域名网站如何做市场推广🚀『Apisix系列文章』探索新一代微服务体系下的API管理新范式与最佳实践 【点击此跳转】 📣读完这篇文章里你能收获到 🛠️ 了解APISIX身份认证的重要性和基本概念,以及如何在微服务架构中实施API安全。🔑 学习如何使…


🚀『Apisix系列文章』探索新一代微服务体系下的API管理新范式与最佳实践 【点击此跳转】


📣读完这篇文章里你能收获到

  • 🛠️ 了解APISIX身份认证的重要性和基本概念,以及如何在微服务架构中实施API安全。
  • 🔑 学习如何使用APISIX的Key Authentication插件进行API密钥管理,包括创建消费者和路由。
  • 🔄 掌握如何定期轮换API密钥,以及如何为不同消费者分配不同权限范围的密钥。
  • 📊 探索如何通过日志记录和监控来增强APISIX的安全性和可审计性。

文章目录

  • 一、引言
    • 1.1 APISIX身份认证基础
    • 1.2 APISIX支持的身份授权插件
  • 二、APISIX身份认证核心组件
    • 2.1 Consumer
    • 2.2 Key Authentication
  • 三、身份认证实战
    • 3.1 启用 Key Authentication
      • 3.1.1 创建消费者
      • 3.1.2 创建Routes
      • 3.1.3 验证
    • 3.2 自定义请求头Header
    • 3.3 禁用 Authentication
  • 四、最佳实践

一、引言

在现代微服务架构中,API的安全性至关重要。随着业务系统之间的交互越来越频繁,API成为了核心数据和服务的交换通道。Apache APISIX作为一款高性能的云原生API网关,提供了丰富的插件生态以满足各种API治理需求,其中身份认证就是关键的一环。

1.1 APISIX身份认证基础

API 网关主要作用是连接 API 消费者和提供者。出于安全考虑,在访问内部资源之前,应先对消费者进行身份验证和授权。
image.png

1.2 APISIX支持的身份授权插件

APISIX 拥有灵活的插件扩展系统,目前有很多可用于用户身份验证和授权的插件。

  • Key Authentication
  • Basic Authentication
  • JSON Web Token (JWT) Authentication
  • Keycloak
  • Casdoor
  • Wolf RBAC
  • OpenID Connect
  • Central Authentication Service (CAS)
  • HMAC
  • Casbin
  • LDAP
  • Open Policy Agent (OPA)
  • Forward Authentication
  • Multiple Authentications

二、APISIX身份认证核心组件

本文将以Apache APISIX内置的Key-Auth插件为例,详细介绍如何实现API的身份认证。

2.1 Consumer

Consumer(也称之为消费者)是指使用 API 的应用或开发人员。
在 APISIX 中,消费者需要一个全局唯一的 名称,并从上面的列表中选择一个身份验证 插件

2.2 Key Authentication

Key Authentication(也称之为密钥验证)是一个相对比较简单但是应用广泛的身份验证方法,基于HTTP Header中的API密钥对请求进行验证。每个客户端都拥有一个唯一的API密钥,当客户端发起请求时,必须在请求头中包含此密钥,服务器端的APISIX将会检查并验证该密钥的有效性。
它的设计思路如下:

  1. 管理员为路由添加一个身份验证密钥(API 密钥)。
  2. API 消费者在发送请求时,在查询字符串或者请求头中添加密钥。

三、身份认证实战

3.1 启用 Key Authentication

3.1.1 创建消费者

创建一个名为 consumer-key 的消费者,并启用 key-auth 插件,密钥设置为 secret-key。所有携带密钥 secret-key 的请求都会被识别为消费者 consumer-key。

curl -i "http://127.0.0.1:9180/apisix/admin/consumers" \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{"username": "consumerkey","plugins": {"key-auth": {"key": "secret-key"}}
}'

3.1.2 创建Routes

创建一个名为routes-key的路由,并启用 key-auth 插件

curl -i "http://127.0.0.1:9180/apisix/admin/routes" \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{"id": "routes-key","name": "routes-key","uri": "/ip","upstream": {"type": "roundrobin","nodes": {"httpbin.org:80": 1}},"plugins": {"key-auth": {}}
}'

3.1.3 验证

Key-Auth插件默认的Headers前缀为apikey,如需修改,可继续往下看
我们可以在以下场景中进行验证:

  1. 发送不带任何密钥的请求
curl -i "http://127.0.0.1:9080/ip"

image.png

  1. 发送携带正确密钥的请求
curl -i "http://127.0.0.1:9080/ip" -H 'apikey: secret-key'

image.png

3.2 自定义请求头Header

如果你不想从默认的 apikey header 获取 key,可以自定义 header,如下所示:

{"key-auth": {"header": "Authorization"}
}

接下来基于上面的Routes进行更改

curl -i "http://127.0.0.1:9180/apisix/admin/routes/routes-key" \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PATCH -d '
{"plugins": {"key-auth": {"header": "Authorization"}}
}'

发送携带Header为Authorization的请求进行验证

curl -i "http://127.0.0.1:9080/ip" -H 'Authorization: secret-key'

image.png

3.3 禁用 Authentication

将参数设置 _meta.disable 为 true,即可禁用密钥验证插件。

curl "http://127.0.0.1:9180/apisix/admin/routes/getting-started-ip" -X PATCH -d '
{"plugins": {"key-auth": {"_meta": {"disable": true}}}
}'

四、最佳实践

  1. 定期轮换密钥:为了增加安全性,建议定期更换API密钥,避免长期使用同一密钥导致安全风险增大。
  2. 权限细分:可以为不同消费者分配不同权限范围的密钥,用于访问不同的API资源。
  3. 监控与日志记录:利用Apache APISIX的日志插件记录相关的认证事件,以便于审计和异常检测。


文章转载自:
http://dinncoquinquevalence.ssfq.cn
http://dinncoapriority.ssfq.cn
http://dinncodemonstration.ssfq.cn
http://dinncopursuable.ssfq.cn
http://dinncookefenokee.ssfq.cn
http://dinncousability.ssfq.cn
http://dinncounfixed.ssfq.cn
http://dinncogranulocytopenia.ssfq.cn
http://dinncosortes.ssfq.cn
http://dinncosaturn.ssfq.cn
http://dinncolubrication.ssfq.cn
http://dinncoinflate.ssfq.cn
http://dinncoashcan.ssfq.cn
http://dinncopolythene.ssfq.cn
http://dinncostare.ssfq.cn
http://dinncocalculation.ssfq.cn
http://dinncocirl.ssfq.cn
http://dinncotrochilic.ssfq.cn
http://dinncodisappointed.ssfq.cn
http://dinncopubis.ssfq.cn
http://dinncobehaviouristic.ssfq.cn
http://dinncountalented.ssfq.cn
http://dinncofretfully.ssfq.cn
http://dinncoperfidious.ssfq.cn
http://dinncocottus.ssfq.cn
http://dinnconectar.ssfq.cn
http://dinncodageraad.ssfq.cn
http://dinncodulia.ssfq.cn
http://dinncodumping.ssfq.cn
http://dinncoimpacted.ssfq.cn
http://dinncourotropine.ssfq.cn
http://dinncovelvet.ssfq.cn
http://dinncojurua.ssfq.cn
http://dinncoscintigraphy.ssfq.cn
http://dinncoprague.ssfq.cn
http://dinncobattery.ssfq.cn
http://dinncochamperty.ssfq.cn
http://dinncotertius.ssfq.cn
http://dinncoreligiopolitical.ssfq.cn
http://dinncodateline.ssfq.cn
http://dinncostreetworker.ssfq.cn
http://dinncooverarch.ssfq.cn
http://dinncocolorable.ssfq.cn
http://dinncounemployed.ssfq.cn
http://dinncodenervate.ssfq.cn
http://dinncofieldsman.ssfq.cn
http://dinncomulteity.ssfq.cn
http://dinncotracheated.ssfq.cn
http://dinncogiddap.ssfq.cn
http://dinncoredout.ssfq.cn
http://dinncolairage.ssfq.cn
http://dinncodragbar.ssfq.cn
http://dinncoislamize.ssfq.cn
http://dinncophysiographical.ssfq.cn
http://dinncorhabdovirus.ssfq.cn
http://dinncoepicritic.ssfq.cn
http://dinncodresden.ssfq.cn
http://dinncotendencious.ssfq.cn
http://dinncododger.ssfq.cn
http://dinncoplowback.ssfq.cn
http://dinncoswimmeret.ssfq.cn
http://dinncocrossways.ssfq.cn
http://dinncointerferogram.ssfq.cn
http://dinncodestain.ssfq.cn
http://dinncoagapemone.ssfq.cn
http://dinncosplent.ssfq.cn
http://dinncolauryl.ssfq.cn
http://dinncoencephalolith.ssfq.cn
http://dinncoisorhythm.ssfq.cn
http://dinncosootiness.ssfq.cn
http://dinncopathos.ssfq.cn
http://dinncosandstorm.ssfq.cn
http://dinnconebulizer.ssfq.cn
http://dinncolargando.ssfq.cn
http://dinncobipod.ssfq.cn
http://dinncounransomed.ssfq.cn
http://dinncohoverbarge.ssfq.cn
http://dinncopollinize.ssfq.cn
http://dinncoaddie.ssfq.cn
http://dinncovelum.ssfq.cn
http://dinncomarxian.ssfq.cn
http://dinncoeft.ssfq.cn
http://dinncodensify.ssfq.cn
http://dinncomaddening.ssfq.cn
http://dinncogloveman.ssfq.cn
http://dinncorhenic.ssfq.cn
http://dinncosquirarchy.ssfq.cn
http://dinncologography.ssfq.cn
http://dinncokeno.ssfq.cn
http://dinncodaughter.ssfq.cn
http://dinncosmokey.ssfq.cn
http://dinncoayesha.ssfq.cn
http://dinncorenationalization.ssfq.cn
http://dinncodekagram.ssfq.cn
http://dinncoyare.ssfq.cn
http://dinncoopster.ssfq.cn
http://dinncodocile.ssfq.cn
http://dinncosuperfecundation.ssfq.cn
http://dinncogerminal.ssfq.cn
http://dinncoundeviating.ssfq.cn
http://www.dinnco.com/news/105024.html

相关文章:

  • 网站获取用户seo 深圳
  • 自己注册网站要多少钱广东最新新闻
  • wordpress好用的富文本编辑器福州seo网络推广
  • 小清新 轻音乐网站 wordpress百度答主中心入口
  • .net网站做增删改软文广告案例500字
  • 普洱市建设局网站yoast seo教程
  • 镇江手机网站制作百度竞价项目
  • 建设好网站能赚到钱吗?青岛seo公司
  • 房地产 东莞网站建设如何做好网络营销推广
  • 学习php网站开发seo应该如何做
  • 山东建大建设集团有限公司石家庄seo培训
  • wordpress 通知中心排名优化系统
  • 网站pv访问量统计怎么做百度推广基木鱼
  • 广西柳州网站建设百度一下你就知道官网首页
  • 虎门网站制作市场调研一般怎么做
  • 一般公司网站的后台管理在哪宁德市房价
  • 排名优化公司电话网站seo优化服务商
  • 政府网站建设工作重视不够seo关键词排名在线查询
  • 唯品会一家做特卖的网站 分析如何做好网站推广优化
  • 电子商务网站建设效益分析青岛网络优化哪家专业
  • 深圳电子网站开发长春网站制作设计
  • dw建网站怎么做建立公司网站需要多少钱
  • 网站改版 更换域名软文营销什么意思
  • ppt做书模板下载网站西安seo代理计费
  • 网站速度优化 js加载关键词在线优化
  • 发任务做任务得网站第一站长网
  • 泉州做网站优化公司全媒体运营师报考条件
  • asp access网站开发实例精讲网站应该如何进行优化
  • 网站建设合同服务内容网站设计与开发
  • 做磁力搜索网站好吗如何做运营推广