[TIL] HTTP : The Definitive Guide "p278 ~ p280"

시윤·2025년 3월 21일

[TIL] Two Pages Per Day

목록 보기
114/146
post-thumbnail

Chapter 12. Basic Authentication

(해석 또는 이해가 잘못된 부분이 있다면 댓글로 편하게 알려주세요.)


✏️ 원문 번역


Authentication Protocol and Headers

HTTP provides an extensible framework for different authentication protocols, through a set of customizable control headers. The format and content of the headers listed in Table 12-1 vary depending on the authentication protocol. The authentication protocol also is specified in the HTTP authentication headers.

  • HTTP는 다양한 커스터마이징 가능한 제어 헤더 집합을 통해 인증 프로토콜에 대한 확장 프레임워크를 제공합니다.

  • Table 12-1에 열거된 헤더의 형식과 내용은 인증 프로토콜마다 상이합니다.

  • 인증 프로토콜은 HTTP 인증 헤더에도 지정되어 있습니다.

HTTP defines two official authentication protocols: basic authentication and digest authentication. In the future, people are free to devise new protocols that use HTTP’s challenge/response framework. The rest of this chapter explains basic authentication. See Chapter 13 for details on digest authentication.

  • HTTP는 basic authentication, digest authentication 두 가지의 공식적인 인증 프로토콜을 정의합니다.

  • 향후 HTTP의 challenge/response 프레임워크를 사용한 새로운 프로토콜을 자유롭게 고안할 수 있습니다.

  • 챕터의 나머지 부분에서는 Basic Authentication에 대해 설명합니다.

  • Digest Authentication에 대해 자세히 알고 싶다면 Chapter 13을 참조해주시기 바랍니다.

To make this concrete, let’s take a look at Figure 12-2.

  • 인증 헤더를 구체적으로 설명하기 위해 Figure 12-2를 살펴봅시다.

When a server challenges a user, it returns a 401 Unauthorized response and describes how and where to authenticate in the WWW-Authenticate header (Figure 12-2b).

  • 서버가 사용자에게 challenge를 요청하는 경우 401 Unauthorized 응답이 반환됩니다.

  • 이때 WWW-Authenticate 헤더에 어디서 어떻게 인증을 해야 하는지에 관한 설명을 담습니다. (Figure 12-2b)

    WWW-Authenticate: Basic realm="Family"

When a client authorizes the server to proceed, it resends the request but attaches an encoded password and other authentication parameters in an Authorization header (Figure 12-2c).

  • 서버에 진행 권한을 부여할 때 클라이언트는 요청을 재전송합니다.

  • 인코딩된 비밀번호와 다른 인증 파라미터는 Authorization 헤더에 첨부합니다. (Figure 12-2c)

When an authorized request is completed successfully, the server returns a normal status code(e.g., 200 OK) and, for advanced authentication algorithms, might attach additional information in an Authentication-Info header (Figure 12-2d).

  • 인가받은 요청이 성공적으로 완료되면 서버는 200 OK와 같은 정상적인 상태 코드를 반환합니다.

  • 더 진화한 인증 알고리즘의 경우 Authentication-Info 헤더에 추가 정보를 덧붙일 수 있습니다. (Figure 12-2d)


Security Realms

Before we discuss the details of basic authentication, we need to explain how HTTP allows servers to associate different access rights to different resources. You might have noticed that the WWW-Authenticate challenge in Figure 12-2b included a realm directive. Web servers group protected documents into security realms. Each security realm can have different sets of authorized users.

  • Basic 인증을 자세히 살펴보기 전, 서버가 HTTP를 통해 다양한 리소스에 다양한 접근 권한을 연결할 수 있는 방법을 설명해야 합니다.

  • Figure 12-2b에 나타난 WWW-Authenticate Challenge가 realm(영역) 지시어를 포함하고 있다는 사실을 이미 눈치채셨을지도 모릅니다.

  • 웹 서버는 보호된 문서를 보안 영역으로 그룹화합니다.

  • 각각의 보안 영역마다 인가 받은 사용자의 집합이 서로 다를 수 있습니다.

For example, suppose a web server has two security realms established: one for corporate financial information and another for personal family documents (see Figure 12-3). Different users will have different access to the realms. The CEO of your company probably should have access to the sales forecast, but you might not give her access to your family vacation photos!

  • 예를 들어 웹 서버가 두 개의 보안 영역을 구축했다고 가정해봅시다.

  • 하나는 기업의 금융 정보를 담고 있으며 다른 하나는 개인적인 가족 문서를 담고 있습니다. (Figure 12-3)

  • 사용자마다 영역에 대한 접근 권한이 다를 것입니다.

  • 여러분이 다니는 회사의 CEO가 판매량을 예측한 정보에는 접근할 수 있어야 하지만 가족 휴가 사진에는 접근할 수 없어야 합니다.

Here’s a hypothetical basic authentication challenge, with a realm specified:

HTTP/1.0 401 Unauthorized
WWW-Authenticate: Basic realm="Corporate Financials"

A realm should have a descriptive string name, like “Corporate Financials,” to help the user understand which username and password to use. It may also be useful to list the server hostname in the realm name—for example, “executive-committee@big-company.com”.

  • 특정 영역에 대한 가상의 Basic Authentication Challenge가 다음과 같다고 해봅시다.

    	HTTP/1.0 401 Unauthorized
    	WWW-Authenticate: Basic realm="Corporate Financials"
  • 영역은 "Corporate Financials"와 같이 문자열로 표현해야 합니다.

  • 사용자가 어떤 username과 password를 통해 접근해야 하는지 알리기 위함입니다.

  • 영역의 이름에 서버의 호스트명을 나열하는 것도 도움이 될 수 있습니다.

  • 가령 "executive-committee@big-company.com"과 같은 식입니다.


✏️ 요약


Authentication Headers

: 인증 과정(Basic Authentication, Digest Authentication 등)에서 사용되는 헤더

  • WWW-Authenticate : 어떤 영역에 대해 어떻게 인증을 수행해야 할지에 관한 정보 제공
    WWW-Authenticate: Basic realm="Family"
    • Basic : Basic Authentication 사용
    • realm : 보안 영역(보안 영역마다 인가 받은 사용자 집합이 다르다 -> 적절한 username과 password를 제공해야 한다)
  • Authorization : 인코딩된 비밀번호와 그 밖의 인증 파라미터 전달
    Authorization: Basic yd13JkU3oNld7ds
  • Authentication-Info : 서버가 인가된 사용자에게 200 OK 응답을 전송할 때 추가적인 정보 제공
profile
틈틈이 두 페이지씩 원서 읽기

0개의 댓글