惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
L
LINUX DO - 热门话题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
V
V2EX
GbyAI
GbyAI
量子位
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
B
Blog
Microsoft Security Blog
Microsoft Security Blog
S
SegmentFault 最新的问题
O
OpenAI News
N
News and Events Feed by Topic
博客园 - Franky
爱范儿
爱范儿
Forbes - Security
Forbes - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V2EX - 技术
V2EX - 技术
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Recent Commits to openclaw:main
Recent Commits to openclaw:main
人人都是产品经理
人人都是产品经理
P
Privacy International News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
Last Week in AI
Last Week in AI
罗磊的独立博客
Spread Privacy
Spread Privacy
Recent Announcements
Recent Announcements
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
The Register - Security
The Register - Security
Y
Y Combinator Blog
J
Java Code Geeks
I
Intezer

博客园 - LCX测试小姐姐

apifox 批量导入和运行项目 Jmeter 与 阿里云 性能测试PTS 作为python自动化测试 推送阿里的通义灵码,大大提高效率 redis测试点 性能测试过程中优化-3: 性能测试过程中优化-2: jmeter 把响应结果数据写入指定txt文件 Elasticsearch 分词功能 Elasticsearch 常用功能 性能测试过程中优化-1: RocketMQ jmeter性能测试实例3解析--性能瓶颈分析过程 pip freeze >requirements.txt python 生成 .exe文件、调用.exe文件 jmeter性能测试实例2解析--linux环境 memcache常用命令 memcache与redis关系与区别 MySql常见性能查询、调优语句和慢sql 性能测试中TPS值上不去分析原因及满足性能指标 mysql之测试工程师必会基础知识
Cookie、session、token、sign鉴权
LCX测试小姐姐 · 2023-11-05 · via 博客园 - LCX测试小姐姐
  • Cookietoken

    请求原理:
    cookie信息 第一次访问及登陆接口的响应头里会返回:set-cookie,包含Uid,sessionId、域名domain;token是在登陆接口的响应体里返回的。其它接口在请求头里携带cookietoken. web通常用cookie,移动端通常用token

    

    Cookie是在响应头里返回的。如下所示:

    

  • Jmetercookie请求:

   “配置元件->HTTP Cookie管理器”来管理,HTTP Cookie管理器里不需要设置,Jmeter自动处理cookie; token“配置元件-> HTTP信息头管理器”来管理,需要人为提取token后添加到HTTP信息头管理器。

Cookie管理器添加放到取样器上面即可,不需要任何操作,如下所示:

  

  Token需要添加token属性,如下所示:

  

Cookie鉴权(第一次请求)

有时Cookie鉴权可以和Session鉴权以及Token鉴权同时使用

因为Session、Token都可以通过Cookie传输

session鉴权(登陆)

接口测试里面不会用,接口自动化里面用到;

Requests方法

Token鉴权(第一次请求和登录)

Csrf_token 15分钟

Refresh_token 一般15天

Cookie、session、token相同点和不同点:
相同点:都是用于鉴权并且都是服务器产生的

不同点:cookie保存在客户端,session保存在服务器端的内存里,session比cookie安全。Token保存在服务器的硬盘里,Token比session更省服务器资源

Postman、jmeter:都需要处理cookie

接口自动化:cookie、session

web自动化:万能验证码

Sign:最复杂的鉴权方式,也是最流行的方式。