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 3237 게시물 읽기
No. 3237
LDAP err 관련 질문 드립니다.
작성자
김효섭(일각천금)
작성일
2012-05-11 13:35ⓒ
2012-05-11 13:39ⓜ
조회수
6,197

JAVA 초보 개발자 입니다. LDAP에 대해서는 거의 모르는 상태라고 보셔두 되구요

LDAP 이용해서(?)지금 JAVA로 AD에 있는 사용자 정보를 가져오려고 하는데요

샘플코드를 받아서 제가 저의 컴퓨터 서버에 맞게 살짝 수정하였습니다.

server 컴퓨터는  window 2008 서버 이구요 거기에 AD를 설치해 놓았습니다.

코드는 다음과 같습니다.

 

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class aa{
 public static void main(String[] args) {
  try {   
   Hashtable env = new Hashtable();
   env.put(Context.INITIAL_CONTEXT_FACTORY,  "com.sun.jndi.ldap.LdapCtxFactory");
   env.put(Context.PROVIDER_URL,"LDAP://125.7.235.123:389"); //replace with your server URL/IP
   //only DIGEST-MD5 works with our Windows Active Directory   
   env.put(Context.SECURITY_AUTHENTICATION, "DIGEST-MD5");

   //No other SALS worked with me   
   env.put(Context.SECURITY_PRINCIPAL,  "cn=dev");
   // specify the username ONLY to let Microsoft Happy   
   env.put(Context.SECURITY_CREDENTIALS, "test12#");
   //the password   
   DirContext ctx = new InitialDirContext(env);
   ctx.close(); 
   } catch(NamingException ne) {
    System.out.println("Error authenticating user:");
    System.out.println(ne.getMessage());
   return;
   }
  //if no exception, the user is already authenticated.
  System.out.println("OK, successfully authenticating user");
  }
}
 

이 코드인데요 자꾸만 에러가 나는데요

Error authenticating user:
[LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0904D1, comment: AcceptSecurityContext error, data 52e, v1771

이 에러가 납니다. 왜 그러는지 알 수 있나요?

제가 LDAP을 처음 해봐서 그러는데 AD에 제가 어떤 설정을 안해줘서 그런건지

혹은 제가 가져오려는 client에 JAR파일 말고 다른 어떤게 필요한지 알고 싶습니다.

LDAP 에서 JAVA로 사용자 정보를 가져올 수 있는 방법과 사용자 게정 정보를 추가 삭제 할 수 있는 방법도

함께 알려 주실 수 있다면 더 감사하겠습니다.

도메인은 ssotest.com 이고 아이디는 dev 비번은 test12#입니다.

  1. Error: Error in bind from LDAP source: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C09030F, comment: AcceptSecurityContext error, data 52e, vece ] javax.naming.AuthenticationException
    Cause: Could not authenticate the user trying to login. This can be the result of an incorrect username or password, or an incorrect prefix and/or suffix specified in the Settings tab, depending on the type of LDAP/AD system. Could also mean the authentication type is incorrect. Also an incorrect username attribute or incorrect name attribute can cause this. Common cause of this error is a user trying to login with DOMAIN\login instead of just login.
     
    제가 인터넷에서 찾아 보았더니 인증 관련 문제라고는 하는데 더이상 어떻게 고쳐야하는지는 모르겠습니다.
이 글에 대한 댓글이 총 1건 있습니다.

에러내용대로 패스워드나 DN이 틀린겁니다.

JAVA에서 LDAP에 직접 로그인하는 모듈을 만드실때에

DN을 아래와 같이 cn=dev로 RDN만 쓰지마시고 전체 Full DN을 사용하여 로그인 프로그램을

수정해 보기 바랍니다.

 env.put(Context.SECURITY_PRINCIPAL,  "cn=dev");
   // specify the username ONLY to let Microsoft Happy   
   env.put(Context.SECURITY_CREDENTIALS, "test12#");
 

 

송상준(sjsong)님이 2012-05-13 02:08에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
3240OID에서 suffix와콘텍스트와 관련된 java검색에 대하여 질문 [2]
열심히
2012-05-22
5456
3239Active Directory PassWord변경시 에러 질문드립니다. [2]
김인성
2012-05-15
7493
3238ldap 11g 설치시 오류 [1]
ldap
2012-05-14
5286
3237LDAP err 관련 질문 드립니다. [1]
김효섭
2012-05-11
6197
3236openldap 라이브러리 사용시 TLS/SSL 사용 방법 문의 [1]
자운몽
2012-04-19
4535
3235__db.00x [1]
abc
2012-04-03
4176
3234ldap 성능 test [4]
미야
2012-04-02
5117
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.049초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다