gpt4 book ai didi

grails - 设置URL以使用Spring Security Rest刷新Grails中的 token JWT

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

我正在使用 Spring 安全支架。实际上是使用以下URL刷新 token 即时消息:/oauth/access_token?grant_type=refresh_token&refresh_token=token
但是我正在使用api rest,我想使用/api/oauth刷新 token 而不是/oauth.
我尝试在urlMappings中重定向,但未找到响应404。

"/api/oauth"(redirect: '/oauth')

最佳答案

"/api/oauth"(redirect: '/oauth')



如您所见,该映射将不起作用,但无论如何可能没有充分的理由使用重定向。该插件提供了这样的映射:
"/oauth/access_token"(controller: 'restOauth', action: 'accessToken')

(请参阅 https://github.com/alvarosanchez/grails-spring-security-rest/blob/d5940921b4aea466a961957e0599321d01e4c6de/spring-security-rest/grails-app/controllers/grails/plugin/springsecurity/rest/RestOauthUrlMappings.groovy#L24)

您可以将所需的任何URL映射到该 Controller 。你可以做...
"/api/oauth"(controller: 'restOauth', action: 'accessToken')

关于grails - 设置URL以使用Spring Security Rest刷新Grails中的 token JWT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59902058/

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