2

I have a project where I use SpringDoc OpenAPI library to auto generate my docs. I have some endpoints like so

@Operation(tags = "Something")
@RequestMapping( . . . )
@PreAuthorize("isSuperadmin() || hasRole('MegaRole')")
public void doSomething() {
    . . .
}

Is it possible for SpringDoc to automatically read the @PreAuthorize statement so it can show somehow what's within it? That way users would see which permissions do they need to call the endpoints.

RabidTunes
  • 775
  • 1
  • 8
  • 21

1 Answers1

0

Same question as this one: Automatic Swagger annotation-based description generation in Springdoc

I have experimented this answer, you must just change the algorithm to parse preAuthorizeAnnotation.get().value() to recognize hasRole embedded value or other specifics attributes.

jpep1
  • 210
  • 2
  • 8