설명
작업에 security: []를 지정하면 전역 인증 요구사항을 상속하지 않습니다. 공개하려는 작업에만 이 설정을 사용하세요.
잠재적 영향
클라이언트가 해당 작업을 호출할 때 인증 정보를 생략할 수 있습니다.
해결 방법
전역 정책을 상속하려면 작업의 security 필드를 삭제하세요. 다른 요구사항이 필요하면 해당 작업에 인증 방식과 스코프를 지정하고 서버 설정과 일치하는지 확인하세요.
예시
변경 후 GET /는 전역 정책과 같은 OAuth2의 read 스코프를 명시합니다. 예시 URL은 공급자의 OAuth2 엔드포인트로 바꾸세요.
변경 전
json
{
"openapi": "3.0.0",
"paths": {
"/": {
"get": {
"security": [],
"responses": {
"200": {
"description": "ok"
}
}
}
}
},
"security": [
{
"OAuth2": [
"read"
]
}
],
"info": {
"title": "Simple API overview",
"version": "1.0.0"
},
"components": {
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://example.com/oauth/authorize",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"read": "Read API versions"
}
}
}
}
}
}
}
변경 후
json
{
"openapi": "3.0.0",
"paths": {
"/": {
"get": {
"security": [
{
"OAuth2": [
"read"
]
}
],
"responses": {
"200": {
"description": "ok"
}
}
}
}
},
"security": [
{
"OAuth2": [
"read"
]
}
],
"info": {
"title": "Simple API overview",
"version": "1.0.0"
},
"components": {
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://example.com/oauth/authorize",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"read": "Read API versions"
}
}
}
}
}
}
}