개별 작업에 OAuth2 비밀번호 흐름 사용

작업별 인증에서 OAuth2 비밀번호 흐름을 사용하면 클라이언트가 사용자 비밀번호를 직접 전달합니다.

설명

OAuth2의 password 흐름에서는 클라이언트가 사용자의 비밀번호를 직접 받습니다. RFC 9700은 이 흐름의 사용을 금지합니다.

잠재적 영향

비밀번호가 클라이언트에도 전달되며, 여러 단계가 필요한 다중 인증(MFA)을 지원하기 어렵습니다.

해결 방법

사용자가 직접 로그인하는 작업은 클라이언트와 인가 서버를 PKCE를 사용하는 인가 코드 흐름으로 전환하세요. 명세의 flow를 accessCode로 바꾸고 공급자의 HTTPS 엔드포인트와 작업에 필요한 스코프를 지정하세요.

예시

예시의 GET /는 변경 후에도 petstore_auth의 read:api 스코프를 요구합니다.

변경 전

json
{
  "swagger": "2.0",
  "paths": {
    "/": {
      "get": {
        "security": [
          {
            "petstore_auth": [
              "read:api"
            ]
          }
        ]
      }
    }
  },
  "securityDefinitions": {
    "petstore_auth": {
      "type": "oauth2",
      "flow": "password",
      "tokenUrl": "https://api.my.company.com/oauth/token",
      "scopes": {
        "read:api": "read your apis"
      }
    }
  }
}

변경 후

json
{
  "swagger": "2.0",
  "paths": {
    "/": {
      "get": {
        "security": [
          {
            "petstore_auth": [
              "read:api"
            ]
          }
        ]
      }
    }
  },
  "securityDefinitions": {
    "petstore_auth": {
      "type": "oauth2",
      "flow": "accessCode",
      "authorizationUrl": "https://api.my.company.com/oauth/authorize",
      "tokenUrl": "https://api.my.company.com/oauth/token",
      "scopes": {
        "write:api": "modify apis in your account",
        "read:api": "read your apis"
      }
    }
  }
}

참조