我正在使用 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/