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 1202 게시물 읽기
No. 1202
LDAP attribute 변경
작성자
양근우(simpact)
작성일
2001-11-12 19:21
조회수
5,315

안녕하세요? Openldap을 JSP에서 Entry 추가, 삭제, 변경하는 코드를 여기서 도움을 받아 어렵게 어렵게 하고 있습니다.

 

비밀번호 변경을 하는 코드를 작성하고 싶은데요...

 

modifyattributes 라는 걸로 하는 것 같더군요. 그런데 javadocs 찾아서 해봐도 잘 안되거든요... 도움부탁드립니다. 사용자가 자신의 암호를 변경하고자 할때 LDAP Server의 해당 Object에서 password를 변경하도록 하고 싶습니다.

 

코드는 아래와 같습니다.

 

-----------------

Hashtable env = new Hashtable(11);

 

// LDAP 서버 설정

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

env.put(Context.PROVIDER_URL, "ldap://isir.kaist.ac.kr:389/");

env.put(Context.SECURITY_PRINCIPAL, "cn=Manager,dc=kms,dc=kaist,dc=ac,dc=kr");

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

 

// request로 넘어온 값을 변수에 할당하여 LDAP Entry Attribute에 할당할 수 있도록 준비

String password= new String();

 

password= "1111";

//password= request.getParameter("password");

 

 

try {

 

DirContext ctx = new InitialDirContext(env);

 

Attributes attrs = new BasicAttributes(true);

//Attribute objclass = new BasicAttribute("objectclass");

Attribute passwd = new BasicAttribute("userPassword");

//objclass.add("uidObject");

passwd.add( password );

 

String ldapDN = new String();

 

ldapDN = "cn=" + userid + ",dc=kms,dc=kaist,dc=ac,dc=kr";

 

//Context result = ctx.createSubcontext (ldapDN, attrs);

ctx.modifyAttributes (ldapDN, REPLACE_ATTRIBUTE, attrs);

//ctx.modifyAttributes (ldapDN, 1, attrs);

 

//ctx.modifyAttributes ("userPassword", "cn=" + userid + ",dc=kms,dc=kaist,dc=ac,dc=kr");

 

 

 

 

//result.close();

ctx.close();

 

//response.sendRedirect( "member_insert_confirm.jsp" );

 

} catch (Exception e) {

out.println("에러 메시지: " + e);

}

------------------------------------

 

어디가 틀렸는지 모르겠습니다.

 

그럼 부탁드립니다. 꾸벅...

 

좋은 하루되세요...

 

simpact....

[Top]
No.
제목
작성자
작성일
조회
1209[질문] 컴파일이 안됩니다.
박광제
2001-11-15
5026
1215┕>Re: [질문] 컴파일이 안됩니다.
초보리눅스
2001-11-16 17:49:56
5533
1218 ┕>Re: Re: [질문] 컴파일이 안됩니다.
박광제
2001-11-19 10:33:29
6079
1208ldap에서의 Image, sound,,, 등
궁금
2001-11-15
4859
1207아이플래닛..에서...
이수진
2001-11-14
5109
1221┕>Re: 아이플래닛..에서...
dugi
2001-11-20 08:46:19
5975
1202LDAP attribute 변경
양근우
2001-11-12
5315
1204┕>Re: LDAP attribute 변경
이수진
2001-11-13 14:36:08
6571
1200[도움] 설치에서 문제가 생겨서여
초보리눅스자
2001-11-12
5021
1203┕>Re: [도움] 설치에서 문제가 생겨서여
이수진
2001-11-13 14:20:11
5585
1205 ┕>Re: Re: 답변에 감사드립니다....휴..
초보리눅스
2001-11-13 17:06:35
5152
1199GNU PG 설치어떻게 하는지요...
양철호
2001-11-09
4695
1198방법 좀 알려주세요! [1]
이잎새
2001-11-09
4907
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.020초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다