gpt4 book ai didi

grails - 如何在Spring Security Rest中自定义登录的响应

转载 作者:行者123 更新时间:2023-12-02 15:16:31 26 4
gpt4 key购买 nike

使用Grails 3和Spring Security Rest,我正在调用URI localhost:8080/api/login来验证用户身份。

响应为:

{
access_token: "eyJhbGciOiJIUzI1...",
roles: [...],
username: "username"
}

但是我想自定义此响应以返回完整的 User对象。像这样:
{
access_token: "eyJhbGciOiJIUzI1...",
roles: [...],
username: "username",
fullName: "Full Name",
mobile: "123345678",
adress: "...",
...
}

我怎样才能做到这一点?

最佳答案

首先实现AccessTokenJsonRenderer并将其注册在resources.groovy中。

关于grails - 如何在Spring Security Rest中自定义登录的响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57174626/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com