2017-06-14 75 views
0

這裏我swagger.yaml:招搖:基本身份驗證工作不

... 
paths: 
/api/geocode: 
    get: 
    .... 
responses: 
    200: 
     description: "OK" 
     schema: 
     $ref: "#/definitions/ResourcesOfGeocodingInformation" 
    204: 
     description: "Pas de résultat" 
     schema: 
     $ref: "#/definitions/ResourcesOfGeocodingInformation" 
    401: 
     description: "Unauthorized" 
    403: 
     description: "Forbidden" 
    404: 
     description: "Not Found" 
    500: 
     description: "Erreur technique" 
    504: 
     description: "Via Michelin ne répond pas " 
    security: 
    - basicAuth: [] 
    x-swagger-router-controller: "Geocode" 
    securityDefinitions: 
    basicAuth: 
    type: "basic" 
definitions: 
... 

但是當我嘗試請求此WS無需驗證這是工作,給我一個200點的狀態。 有什麼問題?

+0

難道你的後臺實際執行基本身份驗證? – Helen

回答

0

確保正確縮進。因爲你已經完成了文檔中的所有內容。你有沒有試圖「保護」整個文檔的根級security作業?

securityDefinitions: 
    basicAuth: 
    type: basic 

# To apply Basic auth to the whole API: 
security: 
    - basicAuth: [] 

像這樣。

+0

相同,仍爲200狀態:/ – Lempkin