> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> HTTP 문서

# HTTP

export const CloudNotSupportedBadge = () => {
  return <div className="cloudNotSupportedBadge">
            <div className="cloudNotSupportedIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path strokeWidth="1.5" d="M6.33366 12.6666L12.3739 12.6667C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00003 12.3739 8.00003C12.3739 8.00003 12.3337 7.66659 12.0003 7.33325M10.667 5.33322C8.00033 2.33325 4.45395 4.78537 4.14195 6.68203C2.55728 6.7627 1.29395 8.06203 1.29395 9.6667C1.29395 11.3234 2.66699 12.6666 4.00033 12.6666" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.5" d="M2.66699 14L12.0003 4.66663" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
            </svg>

        </div>
            ClickHouse Cloud에서 지원되지 않음
        </div>;
};

<CloudNotSupportedBadge />

<Note>
  이 페이지는 [ClickHouse Cloud](https://clickhouse.com/cloud)에는 적용되지 않습니다. 여기에서 설명하는 기능은 ClickHouse Cloud 서비스에서 지원되지 않습니다.
  자세한 내용은 ClickHouse의 [Cloud Compatibility](/docs/ko/products/cloud/guides/cloud-compatibility) 가이드를 참조하십시오.
</Note>

HTTP server를 사용하여 ClickHouse 사용자를 인증할 수 있습니다. HTTP 인증은 `users.xml` 또는 로컬 access control 경로에 정의된 기존 사용자에 한해 외부 인증자로만 사용할 수 있습니다. 현재는 GET 메서드를 사용하는 [Basic](https://datatracker.ietf.org/doc/html/rfc7617) 인증 방식만 지원합니다.

<div id="http-auth-server-definition">
  ## HTTP 인증 서버 정의
</div>

HTTP 인증 서버를 정의하려면 `config.xml`에 `http_authentication_servers` 섹션을 추가하십시오.

**예시**

```xml theme={null}
<clickhouse>
    <!- ... -->
    <http_authentication_servers>
        <basic_auth_server>
          <uri>http://localhost:8000/auth</uri>
          <connection_timeout_ms>1000</connection_timeout_ms>
          <receive_timeout_ms>1000</receive_timeout_ms>
          <send_timeout_ms>1000</send_timeout_ms>
          <max_tries>3</max_tries>
          <retry_initial_backoff_ms>50</retry_initial_backoff_ms>
          <retry_max_backoff_ms>1000</retry_max_backoff_ms>
          <forward_headers>
            <name>Custom-Auth-Header-1</name>
            <name>Custom-Auth-Header-2</name>
          </forward_headers>

        </basic_auth_server>
    </http_authentication_servers>
</clickhouse>

```

참고로, `http_authentication_servers` 섹션 내에서 서로 다른 이름을 사용해 여러 HTTP 서버를 정의할 수 있습니다.

**매개변수**

* `uri` - 인증 요청을 보낼 URI

server와 통신하는 데 사용하는 socket의 밀리초 단위 timeout:

* `connection_timeout_ms` - 기본값: 1000 ms.
* `receive_timeout_ms` - 기본값: 1000 ms.
* `send_timeout_ms` - 기본값: 1000 ms.

재시도 매개변수:

* `max_tries` - 인증 요청을 수행하는 최대 시도 횟수입니다. 기본값: 3
* `retry_initial_backoff_ms` - 재시도 시 초기 백오프 인터벌입니다. 기본값: 50 ms
* `retry_max_backoff_ms` - 최대 백오프 인터벌입니다. 기본값: 1000 ms

전달 헤더:

이 부분에서는 클라이언트 요청 헤더에서 외부 HTTP 인증자로 전달할 헤더를 정의합니다. 헤더는 설정에 지정된 항목과 대소문자를 구분하지 않고 일치 여부를 확인하지만, 전달될 때는 수정 없이 원래 형태 그대로 전달됩니다.

<div id="enabling-http-auth-in-users-xml">
  ### `users.xml`에서 HTTP 인증 활성화
</div>

사용자에 대해 HTTP 인증을 활성화하려면 사용자 정의에서 `password` 또는 이와 유사한 섹션 대신 `http_authentication` 섹션을 지정하십시오.

매개변수:

* `server` - 앞서 설명한 대로 기본 `config.xml` 파일에 구성된 HTTP 인증 server의 이름입니다.
* `scheme` - HTTP 인증 방식입니다. 현재는 `Basic`만 지원됩니다. 기본값: Basic

예시 (`users.xml`에 추가):

```xml theme={null}
<clickhouse>
    <!- ... -->
    <my_user>
        <!- ... -->
        <http_authentication>
            <server>basic_server</server>
            <scheme>basic</scheme>
        </http_authentication>
    </test_user_2>
</clickhouse>
```

<Note>
  HTTP authentication은 다른 인증 메커니즘과 함께 사용할 수 없습니다. `http_authentication`과 함께 `password` 같은 다른 섹션이 있으면 ClickHouse가 강제 종료됩니다.
</Note>

<div id="enabling-http-auth-using-sql">
  ### SQL을 사용한 HTTP 인증 활성화
</div>

ClickHouse에서 [SQL 기반 액세스 제어 및 계정 관리](/docs/ko/concepts/features/security/access-rights#access-control-usage)가 활성화된 경우, HTTP 인증으로 식별되는 사용자도 SQL 문을 사용해 생성할 수 있습니다.

```sql theme={null}
CREATE USER my_user IDENTIFIED WITH HTTP SERVER 'basic_server' SCHEME 'Basic'
```

...또는 명시적으로 스키마를 정의하지 않으면 `Basic`이 기본값으로 사용됩니다

```sql theme={null}
CREATE USER my_user IDENTIFIED WITH HTTP SERVER 'basic_server'
```

<div id="passing-session-settings">
  ### 세션 설정 전달
</div>

HTTP 인증 서버의 응답 본문이 JSON 포맷이며 `settings` 하위 객체를 포함하는 경우, ClickHouse는 해당 key: value 쌍을 문자열 값으로 파싱하여 인증된 사용자의 현재 세션 설정으로 설정하려고 시도합니다. 파싱에 실패하면 server의 응답 본문은 무시됩니다.
