1 つのプロジェクトの LDAP 構成を確認
指定されたプロジェクトの LDAP 設定を検証します。このリソースを使用するには、リクエスト元のサービス アカウントまたは API キーにプロジェクト オーナー ロールが必要です。
path パラメータ
-
プロジェクトを識別する一意の 24 桁の 16 進数文字列。 認証済みユーザーがアクセスできるすべてのプロジェクトを取得するには、 /groups エンドポイントを使用します。
注: グループとプロジェクトは同義語です。そのため、グループ ID はプロジェクト ID と同じです。既存のグループの場合、グループ/プロジェクト ID は同じままです。リソースおよび対応するエンドポイントでは、グループという用語が使用されます。
形式は次のパターンと一致する必要があります:
^([a-f0-9]{24})$
。
クエリ パラメータ
-
アプリケーションがレスポンスを
envelope
JSON オブジェクトにラップするかどうかを示すフラグ。一部の API クライアントは、HTTP レスポンス ヘッダーまたはステータス コードにアクセスできません。これを修正するには、クエリで envelope=true を設定します。結果のリストを返すエンドポイントは、結果オブジェクトをエンベロープとして使用します。アプリケーションは、レスポンス本体にステータス パラメータを追加します。デフォルト値は
false
です。 -
レスポンス本体を pretty-print 形式にするかどうかを示すフラグ。
デフォルト値は
false
です。Prettyprint
body
必須
指定された検証対象プロジェクトの LDAP 設定。
-
認証された MongoDB ユーザーに関連付けられた LDAP(Lightweight Directory Access Protocol)グループを返す LDAP クエリを作成するためにMongoDB Cloud が適用する、LDAPクエリ テンプレート。MongoDB Cloud はこのパラメーターをユーザー認証にのみ使用します。
{USER}
認証されたユーザー名を置き換えるには、Uniform Resource Locator( URL )の プレースホルダーを使用します。クエリは、ホスト名で指定されたホストに関連しています。このクエリの形式は RFC4515 および RFC4516 に従います。デフォルト値は
{USER}?memberOf?base
です。 -
MongoDB Cloud が bindUsername を認証する際に使うパスワード。
-
MongoDB Cloud が LDAP ホストへの接続に使用する LDAP(Lightweight Directory Access Protocol)ユーザーの完全な DN(Distinguished Name、識別名)。LDAP 識別名の形式は RFC 2253 に従う必要があります。
形式は次のパターンと一致する必要があります:
^(?:(?<cn>CN=(?<name>[^,]*)),)?(?:(?<path>(?:(?:CN|OU)=[^,]+,?)+),)?(?<domain>(?:DC=[^,]+,?)+)$
。RFC 2253 -
MongoDB Cloud が LDAP(Lightweight Directory Access Protocol)ホストの ID を確認するために使用する CA(Certificate Authority、認証局)証明書。MongoDB Cloudは自己署名証明書を許可しています。割り当てられた値を削除するには、
"caCertificate": ""
のように空の文字列を渡します。 -
LDAP(Lightweight Directory Access Protocol)ホストのホスト名または IP(Internet Protocol)アドレスを識別する、人間が判読可能なラベル。このホストは、インターネットにアクセスできるか、クラスターへの VPC(Virtual Private Cloud、仮想プライベートクラウド)ピアリング接続が必要です。
形式は次のパターンと一致する必要があります:
^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$
。 -
LDAP(Lightweight Directory Access Protocol)ホストがクライアント接続をリッスンする IANA ポート。
デフォルト値は
636
です。
atlas api ldapConfiguration verifyGroupUserSecurityLdap --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20230101001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.VerifyGroupUserSecurityLdapApiParams{}
sdkResp, httpResp, err := client.LDAPConfigurationApi.
VerifyGroupUserSecurityLdapWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify" \
-d '{ <Payload> }'
{
"authzQueryTemplate": "{USER}?memberOf?base",
"bindPassword": "string",
"bindUsername": "CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com",
"caCertificate": "string",
"hostname": "string",
"port": 636
}
{
"groupId": "32b6e34b3d91647abb20e7b8",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"request": {
"bindUsername": "CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com",
"caCertificate": "string",
"hostname": "string",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"port": 636
},
"requestId": "32b6e34b3d91647abb20e7b8",
"status": "FAIL",
"validations": [
{
"status": "FAIL",
"validationType": "AUTHENTICATE"
}
]
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}