I use Swagger-ui version 3.0.2 , I placed it locally and provided it with my Json file and an API that opens document fine and lists the whole method in the json file, after I included basic authentication in it, I made changes to the file .JSON, but there are some methods that I want to note anonymous.
{
"swagger": "2.0",
"info": {
"description": "description",
"version": "1.0",
"title": "API"
},
"host": "localhost",
"schemes": [
"http"
],
"securityDefinitions": {
"anonymous_auth": {
"type": ""
},
"basic_auth": {
"type": "basic",
"name": "basic_auth",
"description": "Basic Authentication"
},
"token": {
"type": "apiKey",
"description": "API Token Authentication",
"name": "apikey",
"in": "header"
}
},
"security": [
{
"basic_auth": [ ]
},
{
"token": [ ]
}
],
"paths": {
},
"definitions": {
}
}
Using the security attribute in this way, it will protect the complete file, but I have some methods that should be anonymous.
source
share