Support empty security
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When I add global security. I can’t exclude one api from the @ApiSecurity()
.
const docBuilder = new DocumentBuilder().addSecurityRequirements('bearer')
Expected behavior
We can define global security follow the document openapi authentication and exclude from the path by set security: [] # No security
.
Now we can use SetMetadata('swagger/apiSecurity', [])
to hack this feature when define ClassDecorator
. But the this data has been omit when define the MethodDecorator
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Windows Security is Empty - Microsoft Community
Let's try to perform the troubleshooting methods below and check if any of the resolves fixes the issue. 1. Boot your computer to...
Read more >How to fix empty Windows 11 Security or Defender App?
1. First Fix: Update the Operating System. 2. Repair and Reset the Windows Security App. 3. Reinstall the Security App via Windows Terminal...
Read more >Control traffic to resources using security groups
Use security groups to control the inbound and outbound traffic for associated resources.
Read more >Guardium Policy Rule Fires on Empty Group - IBM
IBM Security Guardium policy rules may fire unexpectedly if a condition contains an empty group.
Read more >Empty ‒ Qlik Sense for administrators - Qlik | Help
Empty (). Action: update. This rule lets the user update an app, provided that the app is not ... Conditions (Advanced view) ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone that still needs a workaround, I modified the above code to get it working:
And then where my server is initialized:
Having followed the officiel NestJS docs to secure my API, all my routes are protected by an API-Key, and some of them can avoid it, with a
Public()
decorator (as explained in the docs)In order to get Swagger to use that API Key, and not wanting to manually add
@ApiSecurity()
on all my routes excepted the few that are public, I used the following :in addition to
However, I don’t understand where I need to put the
ApiFixEmptySecurity
? (@zzdhidden can you explain ? Your code piece was already really useful, thanks for that !)@kamilmysliwiec I understand your answer in #1319 but I think one more decorator would be useful : sometimes you’ll want to have
@ApiSecurity()
(orApiBearerAuth()
or anything) enabled only on some of your routes, and sometimes you’ll want to enable Auth globally and disable it on some of your routes, that’s only one decorator, for a “big” benefit, no ?