LDAPを使用している場合は、Basicのように認証を渡すことができます。ユーザー名とパスワードがわかっている場合は、ヘッダ "Authorization"に値 "Basic base64_token"を追加します。
base64トークンは、ユーザー名とパスワードをusername:passwordの形式でbase64でエンコードした文字列です。理想的には、これはうまくいくはずです。それが動作しない場合は教えてください。その場合、SPNEGOを使用してオプションを探索できます。
JAVAでのLDAPのためのコード:
public class Main
{
public static void main(String[] args)
{
//Replace username and password with your username and password
token = Base64.getEncoder().encodeToString((username + ":" + password).getBytes())
conn = (HttpURLConnection) endpoint.openConnection();
// Set the necessary header fields, which in this case is Basic
conn.addRequestProperty("Authorization", "Basic " + token);
//Continue to do what you want to do after this. This should authenticate
// you to the server
}
}