简体   繁体   English

Swagger - spring 狐狸 - 隐藏密码

[英]Swagger - spring fox - hide password

Swagger - spring fox - hide password. Swagger - spring 狐狸 - 隐藏密码。

In one of our API I need to return alphanumeric code after verifying user id and password.在我们的 API 之一中,我需要在验证用户 ID 和密码后返回字母数字代码。

We are using springfox-swagger-ui-2.3.1 .I have a field "password" where I do not want to show password (instead i want to show "XXXX") when user types in swagger ui.我们正在使用springfox-swagger-ui-2.3.1 。当用户输入 swagger ui 时,我有一个字段“密码”,我不想在其中显示密码(相反我想显示“XXXX”)。

password is defined as @RequestParam(value = "password") String password.密码定义为@RequestParam(value = "password") 字符串密码。

any suggestion is highly appreciated.非常感谢任何建议。

Unfortunately springfox does not provide support for swagger-core 's password format.不幸的是, springfox 不支持swagger-core的密码格式。

It was introduced in swagger-core 1.5.11 #469它是在 swagger-core 1.5.11 #469 中引入的

Issue #2366 is still open in springfox.问题#2366在 springfox 中仍然开放。

To use password as a parameter type, you can simply override the format like this:要将密码用作参数类型,您可以简单地覆盖如下格式:

@ApiParam(value = "your password", type = "string", format = "password") 
@QueryParam(/* normal stuff */)

hidden password for APiParam APiParam 的隐藏密码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM