LDAP异常 - 每个语法的值#0无效

时间:2017-06-12 12:55:38

标签: java ldap unboundid-ldap-sdk

我是LDAP和Unbound ID SDK for Java的新手,我在将我的应用程序中的用户角色添加到LDAP服务器时遇到问题(角色分组为ou = roles,dc = test,dc = com和作为一部分对于ou = roles子树,每个角色应该是groupOfUniqueMembers类型的条目。

但是我遇到了以下问题:

错误ldap.service.LDAPService - LDAPException(resultCode = 21(无效属性语法),errorMessage ='uniqueMember:值#0每个语法无效',diagnosticMessage ='uniqueMember:值#0每个语法无效')

我构建AddRequest的方式如下:

String[] ldifLines = {
 "dn: ou=roles,dc=test,dc=com",
 "objectClass: groupOfUniqueNames",
 "uniqueMember: uid=test.user",  // initialMember
 "cn: Admin"
};
AddRequest request = new AddRequest(ldifLines);
connection.add(request);        // <- this line throws the exception

P.S。 connection是一个LDAPConnection对象,它正确地连接到我的ldap服务器,因为SearchRequests和DeleteRequests执行正常,所以问题似乎不存在(它可能是我的服务器的配置方式!)。

服务器使用LDAP版本3。

如果我提供的信息不充分,请指出我应该包括的内容。

提前致谢

1 个答案:

答案 0 :(得分:0)

您无法将groupOfUniqueNames的objectClass添加到OUorganizationalUnit已是String[] ldifLines = { "dn: cn=Admin,ou=roles,dc=test,dc=com", "objectClass: groupOfUniqueNames", "uniqueMember: uid=test.user", // initialMember "cn: Admin" };

的objectClass

您应该尝试使用LDIF:

using UnityEngine;
using System.Collections.Generic;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour 
{
    // Create Singleton
    public static GameManager instance = null;

    // Set Default Background Color
    public Color defaultColor;

    // Restart variables
    private Vector3 prevMousePosition;
    public GameObject timeOutWarningDialog;
    public GameObject restartDialog;
    public float countdownLength;
    public float timeUntilCountdown;

    // Game Controller
    private GameObject canvas;
    private GameObject gameManager;
    public GameObject timerInstance;
    public Object startingScene;
    private Scene currentScene;

    // File System List of Folders
    public List<string> folders;

    void Awake()
    {
        if (instance == null)
            instance = this;
        else if (instance != null)
            Destroy(gameObject);

        DontDestroyOnLoad(gameObject);

        gameManager = GameObject.FindGameObjectWithTag("GameManager");
    }

    void Start()
    {       
        prevMousePosition = Input.mousePosition;
        currentScene = SceneManager.GetActiveScene();
    }

    void Update()
    {
        if(Input.anyKeyDown || Input.mousePosition != prevMousePosition)
            if(currentScene.name != startingScene.name)
                StartGameTimer();
        prevMousePosition = Input.mousePosition;
    }

    // GAME TIMER

    void StartGameTimer()
    {
        //  Debug.Log("Game Timer Started");
        CancelInvoke();

        if (GameObject.FindGameObjectWithTag("Timer") == null)
            Invoke("ShowRestartWarning", timeUntilCountdown);
    }

    void ShowRestartWarning()
    {
        canvas = GameObject.FindGameObjectWithTag("Canvas");

        timerInstance = Instantiate(timeOutWarningDialog);
        timerInstance.transform.SetParent(canvas.transform, false);
        timerInstance.SetActive(true);

        if (timerInstance.activeSelf == true)
            StartRestartTimer();
    }

    void StartRestartTimer()
    {
        CountdownTimer countdownTimer = timeOutWarningDialog.GetComponent<CountdownTimer>();
        countdownTimer.startTimer(countdownLength);

        CancelInvoke();
        Invoke("RestartGame", countdownLength);
    }

    void RestartGame()
    {
        SceneManager.LoadScene(startingScene.name);

        Debug.Log("Game Restarted");
        Debug.Log("Current Scene is " + currentScene.name + ".");
    }

    void DestroyTimer()
    {
        Destroy(GameObject.FindGameObjectWithTag("Timer"));
    }
}