首页 > 解决方案 > 如何将响应属性和 JWT 令牌有效负载属性自定义为 lowerCamelCase

问题描述

oauth 2.0 的成功响应

"access_token": "xxxx",
"expires_in": 123456,
"scope": "read write"

降低驼峰式

"accessToken": "xxxx",
"expiresIn": 123456,
"scope": "read write"

和 jwt 有效载荷属性

{
  "user_name": "xxxxx",
  "scope": [
    "read",
    "write"
  ],
  "exp": 1567481992,
  "authorities": [
    "XXX"
  ],
  "jti": "xxxxxx",
  "client_id": "xxxxxx"
}

降低驼峰式

{
  "userName": "xxxxx",
  "scope": [
    "read",
    "write"
  ],
  "exp": 1567481992,
  "authorities": [
    "XXX"
  ],
  "jti": "xxxxxx",
  "clientId": "xxxxxx"
}

我尝试使用 jackson-property-naming-strategy: LOWER_CAMEL_CASE 但它对我不起作用。

标签: javaspringoauthoauth-2.0jwt

解决方案


推荐阅读