8

Swagger - spring fox - hide password.

In one of our API I need to return alphanumeric code after verifying user id and password.

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.

password is defined as @RequestParam(value = "password") String password.

any suggestion is highly appreciated.

Deane Kane
  • 126
  • 2
  • 15
Ashish S
  • 141
  • 1
  • 7
  • have you tried `@RequestParam(value = "password", type = "string", format = "password")` to see if it supports swagger format? – Saeed.Gh Nov 01 '19 at 04:29

3 Answers3

2

Unfortunately springfox does not provide support for swagger-core's password format.

It was introduced in swagger-core 1.5.11 #469

Issue #2366 is still open in springfox.

imTachu
  • 3,759
  • 4
  • 29
  • 56
1

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

Pawan Maurya
  • 387
  • 2
  • 11
0

Issue is fixed in 2020 release of 3.0.0

https://github.com/springfox/springfox/issues/3002

https://github.com/springfox/springfox/issues/3386

user5722923
  • 33
  • 1
  • 5