database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
ㆍLDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
LDAP Q&A 1868 게시물 읽기
No. 1868
LDAP에 아주 기초적인걸 물어 보려고 하는데요...
작성자
이상준(junnyrang)
작성일
2003-07-23 15:32
조회수
5,900

지금 Iiplanet ldap 서버를 윈도우에서 설치를 하고

처음 ldap의 디렉토리 서버를 구경한 사람입니다

JNDI를 이용해서 LDAP 서버에 내용을 검색만 해 봤는데요

LDAP으로 사용자를 추가 하려고 합니다

책을 보니깐(원서 ㅠㅠ) 사용자 인증 부터 해야 된다고 되어 있던데요

env.put(Context.SECURITY_PRINCIPAL, "이부분...");

"이부분"에 뭐가 들어 가야되는지 잘 모르겠습니다

ldif에 정의된 dn을 써주는 부분 같은데 자꾸 이거때문에 익셉션이 뜨는거 같은데요.

보니깐 여기에 cn=Manager 이게 들어 가는거 같은데 이건 뭔지도 모르겠구요 Common Name인가요??

 

ldap 프로토콜을 이용해서 저장 하기 위해서 무엇 무엇을 해줘야 되는지

그리고 ldap은 프로토콜인데... 백단에 db를 설치 안하고 저장이 가능한지?? 보니깐 ldap 서버 백단에 db2를 사용하는거 같은데...

저장 하기 위한 설정 및 저장 방법에 대해 알고 싶습니다

또 사용자 정보를 넣기 위해서는 ENTRY 추가 후 ADD 해서 넣어야 하는건지... 아니면 다른 방법이 있는지... 궁금합니다

 

고수님들 제발 살려 주세요~~

두서가 맞지가 않은점 이해해 주세요...

이 글에 대한 댓글이 총 1건 있습니다.

import java.util.Hashtable;

import java.util.Date;

 

import javax.naming.*;

import javax.naming.directory.*;

 

class Add {

 

public static void main(String[] args) {

 

/* Values we'll use in creating the entry */

Attribute objClasses = new BasicAttribute("objectclass");

objClasses.add("top");

objClasses.add("person");

objClasses.add("organizationalPerson");

objClasses.add("inetOrgPerson");

 

Attribute cn = new BasicAttribute("cn", "jack");

Attribute sn = new BasicAttribute("sn", "swardseven");

Attribute givenNames = new BasicAttribute("givenname", "Lee");

 

/* Specify the DN we're adding */

String dn = "cn=jack2,dc=rathontech,dc=com " ;

 

 

Hashtable env = new Hashtable(5, 0.75f);

/*

* Specify the initial context implementation to use.

* This could also be set by using the -D option to the java program.

* For example,

* java -Djava.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory \

* Modrdn

*/

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");

 

/* Specify host and port to use for directory service */

env.put(Context.PROVIDER_URL, "ldap://192.168.1.225:4189");

 

/* specify authentication information */

// Bind Type

env.put(Context.SECURITY_AUTHENTICATION, "simple");

//directory manager DN

env.put(Context.SECURITY_PRINCIPAL, "cn=Directory manager");

//directory manager DN password

env.put(Context.SECURITY_CREDENTIALS, "manager123");

 

DirContext ctx = null;

 

try {

/* get a handle to an Initial DirContext */

ctx = new InitialDirContext(env);

Attributes orig = new BasicAttributes();

orig.put(objClasses);

orig.put(cn);

orig.put(sn);

orig.put(givenNames);

 

/* Add the entry */

ctx.createSubcontext(dn, orig);

System.out.println( "Added entry " + dn + ".");

 

} catch (NameAlreadyBoundException e) {

/* If entry exists already, fine. Ignore this error. */

System.out.println("Entry " + dn + " already exists, no need to add");

} catch (NamingException e) {

System.err.println("dn: problem adding entry." + e);

e.printStackTrace();

System.exit(1);

} catch (Exception e){

e.printStackTrace();

}

}

}

jack님이 2003-07-24 12:43에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
1871추가 하는데 entry.javax.naming.AuthenticationException이 발생합니다 [2]
이상준
2003-07-25
5424
1870SunONE Directory Server 새로운기능 추가 내용
송상준
2003-07-24
5164
1869SunONE Directory Server 5.2가 새로이 나왔는데 새로운 기능을 나열
송상준
2003-07-24
5434
1868LDAP에 아주 기초적인걸 물어 보려고 하는데요... [1]
이상준
2003-07-23
5900
1866간단한 한글입력 방법 [1]
송상준
2003-07-22
5374
1865ldapadd시 한글은 입력이 안되나요? [3]
신재훈
2003-07-22
5546
1864[질문] ldap_bind: Invalid credentials (49) 에러가 나네요.. [2]
신재훈
2003-07-22
8355
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.026초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다