Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/ / /
Go 드라이버
/ /

SCRAM 인증 메커니즘

SCRAM(Salted Challenge Response Authentication Mechanism) 은 챌린지-응답 메커니즘을 사용하여 사용자를 인증하는 인증 메커니즘 제품군입니다. SHA-256 알고리즘 사용하여 비밀번호를 해시하는 SCRAM -SHA-256가 기본값 인증 메커니즘 입니다.

SCRAM 사용하여 MongoDB Atlas, MongoDB Enterprise Advanced 및 MongoDB Community Edition 에 인증할 수 있습니다.

SCRAM 메커니즘

SCRAM 인증 메커니즘 제품군에 대해 자세히 학습 Wikipedia의RFC 5802Salted Challenge Response 인증 메커니즘을 참조하세요.

SCRAM 의 MongoDB 구현 에 대한 자세한 내용은 MongoDB Server 매뉴얼의 SCRAM 참조하세요.

각 인증 메커니즘에는 다음과 같은 자리 표시자가 포함되어 있습니다.

  • db_username - MongoDB 데이터베이스 사용자 이름

  • db_password - MongoDB 데이터베이스 사용자의 비밀번호

  • hostname - 클라이언트가 액세스할 수 있는 MongoDB 서버 네트워크 주소

  • port - MongoDB 서버 포트 번호

  • authenticationDb - 사용자의 인증 데이터가 포함된 MongoDB 데이터베이스. 이 옵션을 생략하면 드라이버는 기본값 admin을 사용합니다.

SCRAM-SHA-256 SHA-256 알고리즘 으로 암호화됨 데이터베이스 사용자 사용자 이름 과 비밀번호를 사용하여 사용자를 인증하는 솔티드 챌린지-응답 인증 메커니즘 (SCRAM )입니다. SCRAM-SHA-256 은 기본값 인증 메커니즘 입니다.

기본 인증 메커니즘을 지정하려면 AuthMechanism 옵션을 생략합니다:

credential := options.Credential{
AuthSource: "<authenticationDb>",
Username: "<db_username>",
Password: "<db_password>",
}
clientOpts := options.Client().ApplyURI("mongodb://<hostname>:<port>").
SetAuth(credential)
client, err := mongo.Connect(clientOpts)

SCRAM-SHA-256 인증 메커니즘 명시적으로 지정하려면 AuthMechanism 옵션에 "SCRAM-SHA-256" 값을 할당합니다.

credential := options.Credential{
AuthMechanism: "SCRAM-SHA-256",
AuthSource: "<authenticationDb>",
Username: "<db_username>",
Password: "<db_password>",
}
clientOpts := options.Client().ApplyURI("mongodb://<hostname>:<port>").
SetAuth(credential)
client, err := mongo.Connect(clientOpts)

이 페이지에서 설명하는 메서드 또는 유형에 대해 자세히 학습 다음 API 설명서를 참조하세요.

돌아가기

인증

이 페이지의 내용