AddSecurityDefinition registers an authentication scheme in an OpenAPI document so Swagger UI can describe how callers authorize requests. It defines the scheme; AddSecurityRequirement separately declares which endpoints require it. section 25.5
For JWT bearer authentication, the configuration describes:
- The security requirement that protects the whole API or selected endpoints. section 25.5
Using the scheme in Swagger UI
After configuration, Swagger UI displays an Authorize button. Enter Bearer <token>, including the space and prefix; subsequent requests carry the token in the Authorization header. section 25.5
