http://cloud-gateway:9999/auth/oauth/token
修改hosts cloud-gateway 指向 服务器ip或请求地址直接用服务器ip
VERSION
Content-Type: application/x-www-form-urlencoded
Authorization: Basic d2ViOndlYg==
| 参数 | 类型 | 是否必填 | 释义 |
|---|---|---|---|
| grant_type | string | 是 | 登录方式 |
| 参数 | 类型 | 是否必填 | 释义 | |:---------|------- :|:----: |-----| | username | string | 是 | 账号 | | password | string | 是 | 密码 |
xxxxxx 为加密数据,平台会对每种客户端都分配一个密钥。
在没有登录之前,使用密钥进行加密,并替换xxxxxx部分;
在登录之后xxxxxx替换为登录接口返回的token,
Authorization: token_type token
---------------------------------------------
加密方式: 暂时使用直接加密后的参数
Authorization: Basic d2ViOndlYg==
对password进行AES对称加密,采用CFB模式
ex:
AES aes = new AES(Mode.CFB, Padding.NoPadding,
new SecretKeySpec("sdjurli%*iw18s^1".getBytes(StandardCharsets.UTF_8), "AES"),
new IvParameterSpec("sdjurli%*iw18s^1".getBytes(StandardCharsets.UTF_8)));
System.out.println(aes.encryptBase64("test123".getBytes(StandardCharsets.UTF_8)));
输出结果是 2iIrtaZRSw==
'sdjurli%*iw18s^1'是密钥,对test123进行加密
method: POST
uri:http://cloud-gateway:9999/auth/oauth/token?grant_type=password
Content-Type: application/x-www-form-urlencoded
Authorization: Basic d2ViOndlYg==
username=admin&password=2iIrtaZRSw==
http://192.168.31.78:8080/
账号:admin 密码:test123
swagger文档地址 http://cloud-gateway:9999/swagger-ui/index.html