Auth0 spring Boot实现userId有|

问题描述 投票:0回答:1

我目前将 auth0 添加到我的 Spring Boot api 中,以处理安全性。现在我面临的问题是,auth0 正在使用“|”生成 userId。在里面。 在我的 Spring boot api 中,我有一些 enpoints 将用户 id 作为路径变量,例如 “/用户/{userId}”。这些请求现在收到错误 bc。无效字符 |在标题中。

Error parsing HTTP request header
 Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.

java.lang.IllegalArgumentException: Invalid character found in the request target [/api/v1/user/service/google-oauth2|114309183689720156358 ]. The valid characters are defined in RFC 7230 and RFC 3986

你会如何解决这个问题?

java spring-boot auth0
1个回答
0
投票

您可以在创建 url 之前将其编码为

\u007c

如果您的用户在用户 ID 中包含奇怪的字符(如 æøåûü),此方法也会有所帮助

© www.soinside.com 2019 - 2024. All rights reserved.