Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using AUTHENTICATION_WHITELIST to disable auth in OpenAPI schema #923

Closed
niccolomineo opened this issue Jan 23, 2023 · 5 comments
Closed
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending

Comments

@niccolomineo
Copy link

niccolomineo commented Jan 23, 2023

Hi @tfranzel, as you suggested here, I tried to pass:

'AUTHENTICATION_WHITELIST': [None]

in SPECTACULAR_SETTINGS to suppress the security scheme, but I am getting:

AttributeError: 'NoneType' object has no attribute 'rsplit'

I am using drf 3.14.

@niccolomineo
Copy link
Author

A workaround I just found out to be working is passing an authentication backend that is not currently in use in the project, and the security schema is returned empty / the button is not shown.

@tfranzel
Copy link
Owner

Good point. I just tried to come up with a value that was supposed to satisfy your requirement. This was not an official feature, but I think is worth adding.

@tfranzel tfranzel added the enhancement New feature or request label Jan 23, 2023
@niccolomineo
Copy link
Author

I agree it would be nice to have. I think just a None value for AUTHENTICATION_WHITELIST would suffice. What do you think?

tfranzel added a commit that referenced this issue Feb 17, 2023
new default allowAll is None. [] is denyAll
@tfranzel tfranzel added the fix confirmation pending issue has been fixed and confirmation from issue reporter is pending label Feb 17, 2023
@niccolomineo
Copy link
Author

@tfranzel, I tested it and passing an empty list hides the Authorization button on the GUI. May I suggest that this be documented, also?

@tfranzel
Copy link
Owner

@niccolomineo awesome!

I think this is kinda documented here:

0dfa1dc#diff-9748fb54622c822b7d9a2e29ff074cd8ed22d17b8de898f1ea6d69afcef82c75R160

I would refrain from documenting implementation details of SwaggerUI though. That would be a bottomless pit and I won't even try to 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending
Projects
None yet
Development

No branches or pull requests

2 participants