'개발자세상'에 해당되는 글 103건

  1. 2009.12.15 ASP.NET 크레튜 강의 수강 소감
  2. 2009.12.09 ORA-30557
  3. 2009.11.10 티맥스 소식
  4. 2009.10.28 Oracle Table Column Rename
  5. 2009.10.22 강사의 조건 1
  6. 2009.10.06 Streaming Protocol
  7. 2009.09.24 박대연, 그리고 안철수 1
  8. 2009.09.08 LDAP Query
  9. 2009.09.01 Spring Security 와 Active Directory 연동 -2
  10. 2009.09.01 Spring Security 와 Active Directory 연동
지난 달에 C#을 들으려 했었는데 신청을 잘 못해서 ASP.NET 강의를 듣게 됐다.

뭐... C#다음 강좌로 ASP.NET도 들을려고 했었으니깐 순서만 한번 바뀌었다고나 할까.

들으면서 느낀것은 MS 진영이고 Java 진영이고 서로가 서로에게 긍정적인 영향을 준다고나 할까.

ADO.NET을 보면 JDBC적인 면이 보이고 반대로 JSF를 보면 ASP.NET의 객체 모델이 보이고,
서로에 대해서 자신이 우월성을 얘기하려 노력하지만
결국은 서로의 장점을 취해 가며 발전해 가는 모습을 보면
선의의 경쟁자라 불러도 좋을 듯 싶다.

별 경쟁 없이 있던 브라우저 시장도 Firefox가 힘을 받고 크롭 같은 브라우져가 등장하면서 다시 발전해 가는 것을 보면 독과점의 폐해는 실로 심각하다 할 수 있겠다.

뭐... 어쩃든 다음에 C# 강좌를 마무리로 들어주면 MS 관련 문제가 발생해도 어느정도는 대체할 수 있지 않을까 생각된다.

그리고 크레듀 강좌 들으면서 .... 테크빌에서 했떤 일들이 자꾸 떠올랐다.
그때 그래도 괜찮은 기능들을 많이 많들었다는 생각이 들고
또 한편으로는 내가 100% 소화 해 내지 못했던 것들에 대한 아쉬움도 들고 했다.
그리고 그쪽을 떠난 지도 6년 가까이 되는데 아직도 그떄 일을 생각하는 걸 보면
나에게 많은 아쉬움도 남아 있는 듯 하다.

'개발자세상' 카테고리의 다른 글

이젠 모바일인가...  (2) 2010.12.05
Spring Security  (0) 2009.12.21
티맥스 소식  (0) 2009.11.10
강사의 조건  (1) 2009.10.22
Streaming Protocol  (0) 2009.10.06
Posted by headiron
,
오라클에서 Field 사이즈를 조정하려고 했더니 

"ORA-30556: functional index is defined on the column to be modified"
메시지가 뜬다.

인터넷 뒤져 보니 functional index를 삭제한 후 조정하면 된다고 하는데

Enterprise Manager 나 다른 Tool에서 Functional index를 찾을 수 있는 방법이 없다.

결국 염대리님이
"select * from USER_IND_EXPRESSIONS;" 쿼리를 알려 주셔서 functional index를 찾을 수 있었고 해당 index를 drop 한 후 원래 나오던 column_expression대로 다시 생성을 하니 정상적으로 동작한다.


SQLPLUS>select * from USER_IND_EXPRESSIONS where table_name = '테이블명';

출력 결과 )
INDEX_NAME        TABLE_NAME     COLUMN_EXPRESSION       COLUMN_POSITION
XXXX                    YYYY                NLSSORT("ID",'nls_sort=''BINARY_CI''')    1

SQLPLUS>drop index XXXX;

SQLPLUS>ALTER TABLE XXXX MODIFY ( CCCC VARCHAR2(256));

SQLPLUS> create index XXXX on YYYY(NLSSORT("ID",'nls_sort=''BINARY_CI'''));


참조 : USER_IND_EXPRESSIONS Functional index expressions in user's indexes and indexes on user's tables



'개발자세상 > Database관련' 카테고리의 다른 글

오라클 실행계획 보기  (0) 2010.03.03
ORACLE 사용자 생성  (0) 2010.03.03
Oracle Table Column Rename  (0) 2009.10.28
오라클 Function Compile/ 생성시 Ora-00942 오류..  (1) 2009.06.22
impdp / expdp  (0) 2009.06.19
Posted by headiron
,

티맥스 소식

개발자세상 2009. 11. 10. 13:08
결국 티맥스가 구조조정을 한다는 소식이다.

2000명 중에 600~ 800명 정도 한다고 하니 이건 회사를 운영하겠다는 건지 -.-

뭐.. 나름 회사 운영이 힘들었기 때문이기는 하겠지만

지금까지 진행돼왔던 과정을 보면 참 실망스럽다는 생각이 든다.

특히 다들 제일 걱정을 하는 건 600 ~ 800명에 포함된 사람들이다.

생각해보면 그 사람들 대부분이

주말 저녁도 없이 일한 다는 사실 알고도 박교수가 얘기하는 비전 하나 바라보고 같을 텐데,

또 말도 완되는 조건의 유상증가에도 참여하여

결국 자기 월급 자기 돈으로 주는 말도 안되는 상황만들어 놨으면서

어느 누가 책임진다는 얘기는 들리지 않는다.

적어도 지금까지 그런 악조건 다 참아 가면서 남아 있는 사람들에게

결국 권고 사직이라는 칼을 드리 미는 것은 정말 말이 된단다는 생각 뿐이다.

티맥스가 힘들다는 것 누구나 다 알고 있는 상황에

매번 아니라는 보도자료만 날린다고 달라지는 게 있을지..

그렇게 해서 회사 살리고 또 박교수 꿈대로 국산 OS 만들어 낸다해도

과연 그때 되서 지금껏 박교수 혼자의 꿈을 위해 희생했던

그 많은 사람들에게는 뭐를 줄 생각인건지...


요즘 대형 프로젝트도 별로 없는 듯 한데

그 많은 사람들이 갈 수 있는 곳이 있을지

과연 얼마나 좋은 조건에 갈 수 있을지...

'개발자세상' 카테고리의 다른 글

Spring Security  (0) 2009.12.21
ASP.NET 크레튜 강의 수강 소감  (0) 2009.12.15
강사의 조건  (1) 2009.10.22
Streaming Protocol  (0) 2009.10.06
박대연, 그리고 안철수  (1) 2009.09.24
Posted by headiron
,

Alter table <테이블명> rename column <기존 컬럼명> to <바뀔 컬럼명>;

예전에는 안됐는데....

ㅋㅋㅋ 생각해보니 내가 Oracle 8i 때 많이 쓰고 그 다음 부터는 그닥 많이 쓰지 않았으니 그사이에 이런 기능 추가 되는건 당연하지 ... 벌써 11g 인데

'개발자세상 > Database관련' 카테고리의 다른 글

ORACLE 사용자 생성  (0) 2010.03.03
ORA-30557  (0) 2009.12.09
오라클 Function Compile/ 생성시 Ora-00942 오류..  (1) 2009.06.22
impdp / expdp  (0) 2009.06.19
MYSQL에서 copy_t , copy_ymd 테이블 만들기  (0) 2009.03.13
Posted by headiron
,

강사의 조건

개발자세상 2009. 10. 22. 19:23
이번 주부터 2주간 "EJB3.0 이해와 활용" 강좌를 수강한다.

암만해도 회사에서 계속 EJB를 사용하니 사실 아주 모르는 건 아니지만 조금은 정석적으로 또 3.0 기능에 대해서 좀 더 자세히 알아 보기 위해서 신청을 했는데

첫날 도착해보니 강사가 "고덕한"씨 이다.
내심 넥스트리 임직원 분을 기대 했는데..-.-
흠.... 커뮤니티 내에서 상당히 않 좋은 평을 듣는 사람인데...

일단은 오늘 까지 3일 째 듣고 있는데.
솔직히 강사로서는 좀 별로 인듯하다.

몇 몇 부분을 굳이 저렇게 설명해야 하나 하는 부분도 있고
말투 자체가 들으면서 편한 느낌을 들게 하지 않는다.
( 뭐... 그런 부분이야 개인이 노력한다고 쉽게 될 수 있는 부분도 아니니 이해할 수 있다.)

특히 문제인것은 과연 강의를 하면서 강의를 얼마나 준비하고 강의 하는 지 의심스럽다.

물론 자신이 전문가라는 자신감 때문일지는 모르지만
이런 태도 자체는 문제가 있지 않나 싶다.

계속 이런 저런 강의를 많이 하고 있는 걸 온라인 상에서 많이 봐왔는데.

왜 커뮤니티 상에서 그런 안 좋은 평가를 받는지 조금은 알 수 있을 것 같다.

비록 무료 강좌라도 ( 아마도 본인은 강사료를 받으시겠지만 )
강의를 진행한다면 이에 대한 열정을 보여야 하지 않을까 싶다.

'개발자세상' 카테고리의 다른 글

ASP.NET 크레튜 강의 수강 소감  (0) 2009.12.15
티맥스 소식  (0) 2009.11.10
Streaming Protocol  (0) 2009.10.06
박대연, 그리고 안철수  (1) 2009.09.24
LDAP Query  (0) 2009.09.08
Posted by headiron
,

Streaming Protocol

개발자세상 2009. 10. 6. 15:23
VAST 기반 Application을 개발하면서 Video일때 progressive/streaming을 설정하는 부분이 있어서 Internet을 좀 뒤져 봤다.

일단 VAST가 Video 형식 중 Flash , WMV, RA 형식만을 지원하고 있으므로 이 세가지 경우에 대한 streaming을 체크해 보았다.

1. WMV 파일의 경우  : protocol이 mms로 나갈 경우 streaming으로 볼 수 있음.
2. Flash : protocol이 rtmp, rtmpt(rtmp를 http로 tunneling한 protocol), rtmps(RTMP sent over a secure socket layer), rtmpe(new protocol is an enhanced and encrypted version of RTMP), rtmpte 일 경우 streaming으로 볼 수 있음.
참조 :
http://www.adobe.com/devnet/flashmediaserver/articles/overview_streaming_fms3.html
3. rtsp : RFC 표준 프로토콜로 Real Network 의 Real Server G2 , Apple 의 QuickTime Streaming Server , Darwin Streaming Server ( Apple에서 내 놓은 오픈소스 서버 )
참조 : http://xissy.egloos.com/2908891

http://www.iab.net/media/file/VAST-1_8_pub_comment_FINAL.pdf 파일을 보면 Video 파일 중 streaming 으로 설정가능한 URL Sample이 보인다.
  

'개발자세상' 카테고리의 다른 글

티맥스 소식  (0) 2009.11.10
강사의 조건  (1) 2009.10.22
박대연, 그리고 안철수  (1) 2009.09.24
LDAP Query  (0) 2009.09.08
Spring Security 와 Active Directory 연동 -2  (0) 2009.09.01
Posted by headiron
,
지난주에 개발자 행사로 안철수씨의 동영상 인터뷰를 보게 됐다.

얼마전에 무릎팍도사에 출연한 후 개발자들을 넘어서 범 국민적인 유명인사가 되었으니 개발자 행사에 초청되는건 당연하겠지.

뭐.. 작년 행사에서도 연사를 하셨으니깐.^^

이번에 행사를 들으면서 역시 철학이 있고 멋있는 사람이라는 생각이 들었다.

특히 전망이 아닌 자신이 하고 싶은 것을 해야한다는 말.>^^

생각해 보면 누구나 쉽게 할 수 있으면서도 쉽게 할 수 없는 그런 말 이다.

안철수 씨 ( 이젠 교수님이 익숙해질 법도 한데..) 이기 때문에 공감이 가고 믿음이 드는거 아닌가 싶다.

생각해 보면 IT쪽에는 안철수 교수님 만큼이나 존경 받을 만한 사람이 있다.

박대연 교수 ( 흠... 사실 이제 박대연 교수가 아닌 박대연 회장이라 불러야 하는데..^^ )

본인이 살아왔던 인생 스토리나 지금까지 해 왔던 업적을 그냥 무시하기에는 너무 대단한 인생과 결과를 보여왔다.

어쩌면 약간은 로얄층에 가까운 안철수 교수님 ( 사실 우리나라 제일의 학교의 제일의 학과인 서울대 의대를 들어가서 다녔고 개인적인 관심으로 그 힘든 백신까지 스스로 만들어 내신 분 ) 보다는 고등학교 졸업하고 직장생활하다가 30대 중반에 본인의 꿈을 쫓아 유학을 통해 지금 자리에 선 박대연 회장이 우리에게는 더 현실적일 수 있다는 생각이 든다.

하지만 지금 안철수 교수님과 박대연 회장님의 선 자리를 보면 너무나 큰 아쉬움이 든다.

IT인들 뿐 아닌 국민적 추앙을 한몸에 받는 안철수 교수님에 비해

국산 윈도우 이벤트 발표회도 IT계의 황우석이라는 얘기를 들어야 하는 박대연회장을 보면
참 뭐랄까...

어쩌면 우리는 심정적으로는 박대연 회장을 응원해야 .. 아님 응원하고 있는지도 모른다.

우리와 너무도 가까운 어쩌면 우리 자신일 수 있는 사람이기 떄문에

하지만 그런 애정을 가질 수 있는 사람이기 때문에

우리는 그 사람에 대해 실망하고 질책 하는 것일 지도 모른다.

사실 박대연 회장이 지금까지 회사를 키워 왔던 횡보들은 우리 나라 대부분의 대기업들이 지금의 자리에 오면서 해왔던 것들과 다를바가 없다.
하지만 우리는 지금 삼성과 LG는 우러러 보면서 ( 물론 나 처럼 안 그런 사람도 있지만...^^ 야구만 뺀다면-.-) 티맥스에 대해서는 너무 냉혹한 잣대로만 대하는 건 아닐까 싶다.

그리고 박대연 회장 스스로에게는 더 큰 문제가 있어 보인다.
미들웨어의 국산화 만으로도 박대연 회장은 충분히 존경받을 인물이다.
JEUS의 개발만으로도 티맥스는 충분히 대단한 회사임에는 틀림 없다.
하지만 왜 일지 모르는 강박관념 때문인지 너무도 큰 무리수를 두고 있다.

우리나라 IT를 위해서라는 명제로는 도저히 이해 할 수 없는 행보를 보이고 있는 것 갔다.
어쩌면 우리나라 전체 IT를 볼모로 본인의 야망을 꿈꾸는 건 아닐 까 싶다.

부디 박대연 회장님의 현명한 판단과 행볼르 기대해 본다.
( 티맥스 윈도는 과연 나오기는 하는 걸까.-.-)

'개발자세상' 카테고리의 다른 글

강사의 조건  (1) 2009.10.22
Streaming Protocol  (0) 2009.10.06
LDAP Query  (0) 2009.09.08
Spring Security 와 Active Directory 연동 -2  (0) 2009.09.01
Spring Security 와 Active Directory 연동  (0) 2009.09.01
Posted by headiron
,

LDAP Query

개발자세상 2009. 9. 8. 09:52
Spring Security와 LDAP 연동시 LDAP Query를 사용하게 되어 몇가지 Query를 정리해 본다.

- AD에서 LDAP Query 테스트 방법  : 
   1. "Active Directory 사용자 및 컴퓨터" Tool에서 Domain을 선택 후 ( 하위 메뉴에서도 가능 ) 오른쪽 마우스를 클릭하여 "찾기" 메뉴를 클릭
   2. "사용자,연락처, 그룹 찾기" 창이 팝업 메뉴로 출력
   3. 찾기 메뉴에서 "사용자 지정 검색" 선택
   4. "고급" 탭을 클릭하면 "LDAP 쿼리 입력" TextBox가 나오며 LDAP Query 입력 후 "지금 찾기"를 클릭하면 LDAP Query를 테스트 할 수 있다.
   5. "보기" 메뉴의 "열 선택..." 메뉴를 클릭하면 검색 결과 창에 나오는 필드를 선택할 수 있으며 "X500 고유 이름" 을 추가하면 LDAP 고유 값을 확인할 수 있다.

- LDAP 문법
   & : AND , | : OR 조건이며 
   ()를 기준으로 묶어 가며 AND OR를 적용한다.

- LDAP Filter Query 
  1. 특정 ID의 사용자 검색
      - (&(sAMAccountName={0})(objectclass=user))
        AD 의 사용자 로그인 이름이 {0} ( 위 값은 Spring Security에서 입력된 ID 값으로 대체 됨 )인 사용자를 검색
  2. 특정 ID이며 특정 그룹에 속하는 사용자 검색
      - (&(sAMAccountName={0})(|(memberOf=CN=B3 Approval,CN=Users,DC=dev,DC=247realmedia,DC=local)(memberOf=CN=B3 Reader,CN=Users,DC=dev,DC=247realmedia,DC=local)))
        memberOf 는 특정 Group의 멤버 여부를 체크한다. 따라서 위의 문법은 B3 Approval 이나 B3 Reader Group의 member이며 sAMAccountName ( AD의 사용자 로그인 이름 ) 이 {0}인 사용자를 검색한다.
Posted by headiron
,
인터넷을 뒤지다 보니 Spring Security와 Active Directory를 연동하는 또 다른 방식이 있다.

이 방식은 Customize된 Authentication Class를 생성해야 하는 단점이 있다.

하지만 반대로 우리와 같이 LDAP 연동시 Authorization 관련 로직을 Customize 할 때 쉬울 듯 하다.( 뭐 아직은 해보지 않은 상태 지만 내부 코드를 보면 Role 명을 쉽게 입력할 수 있을 것 같다. )

그리고 인증 방식은 LDAP 형태가 아닌 Computer Name\사용자 계정 형태이다.
( 이 부분이 AD가 아닌 Window 내부 사용자 계정 관리 방식으로 보여 조금 꺼림직 하다. )

하지만 관리자 계정 정보를 필요로 하지 않는 다는 엄청난(?) 장점이 있다.

출처 : http://stackoverflow.com/questions/84680/how-do-you-authenticate-against-an-active-directory-server-using-spring-security 첫번째 댓글

[Spring Security Config]
<beans:bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
       
<beans:constructor-arg value="ldap://hostname.queso.com:389/" />
</beans:bean>

<beans:bean id="ldapAuthenticationProvider" class="org.queso.ad.service.authentication.LdapAuthenticationProvider">
       
<beans:property name="authenticator" ref="ldapAuthenticator" />
       
<custom-authentication-provider />
</beans:bean>

<beans:bean id="ldapAuthenticator" class="org.queso.ad.service.authentication.LdapAuthenticatorImpl">
       
<beans:property name="contextFactory" ref="contextSource" />
       
<beans:property name="principalPrefix" value="QUESO\" />
</beans:bean>

위 내용 중 principalPrefix는 Computuer 명 을 넣으면 된다.
즉 인증시 "컴퓨터명\사용자ID"가 LDAP 서버로 전달된다.

[LdapAuthenticationProvider.java]
/**
 * Custom Spring Security authentication provider which tries to bind to an LDAP server with
 * the passed-in credentials; of note, when used with the custom {@link LdapAuthenticatorImpl},
 * does <strong>not</strong> require an LDAP username and password for initial binding.
 *
 * @author Jason
 */
public class LdapAuthenticationProvider implements AuthenticationProvider {
private LdapAuthenticator authenticator;

       
public Authentication authenticate(Authentication auth) throws AuthenticationException {

               
// Authenticate, using the passed-in credentials.
               
DirContextOperations authAdapter = authenticator.authenticate(auth);

               
// Creating an LdapAuthenticationToken (rather than using the existing Authentication
               
// object) allows us to add the already-created LDAP context for our app to use later.
               
LdapAuthenticationToken ldapAuth = new LdapAuthenticationToken(auth, "ROLE_USER");
               
InitialLdapContext ldapContext = (InitialLdapContext) authAdapter
                               
.getObjectAttribute("ldapContext");
               
if (ldapContext != null) {
                        ldapAuth
.setContext(ldapContext);
               
}

               
return ldapAuth;
       
}

       
public boolean supports(Class clazz) {
               
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(clazz));
       
}

       
public LdapAuthenticator getAuthenticator() {
               
return authenticator;
       
}

       
public void setAuthenticator(LdapAuthenticator authenticator) {
               
this.authenticator = authenticator;
       
}
}
[LdapAuthenticatorImpl.java]
/**
 * Custom Spring Security LDAP authenticator which tries to bind to an LDAP server using the
 * passed-in credentials; does <strong>not</strong> require "master" credentials for an
 * initial bind prior to searching for the passed-in username.
 *
 * @author Jason
 */

public class LdapAuthenticatorImpl implements LdapAuthenticator {

       
private DefaultSpringSecurityContextSource contextFactory;
       
private String principalPrefix = "";

       
public DirContextOperations authenticate(Authentication authentication) {

               
// Grab the username and password out of the authentication object.
               
String principal = principalPrefix + authentication.getName();
               
String password = "";
               
if (authentication.getCredentials() != null) {
                        password
= authentication.getCredentials().toString();
               
}

               
// If we have a valid username and password, try to authenticate.
               
if (!("".equals(principal.trim())) && !("".equals(password.trim()))) {
                       
InitialLdapContext ldapContext = (InitialLdapContext) contextFactory
                                       
.getReadWriteContext(principal, password);

                       
// We need to pass the context back out, so that the auth provider can add it to the
                       
// Authentication object.
                       
DirContextOperations authAdapter = new DirContextAdapter();
                        authAdapter
.addAttributeValue("ldapContext", ldapContext);

                       
return authAdapter;
               
} else {
                       
throw new BadCredentialsException("Blank username and/or password!");
               
}
       
}

       
/**
         * Since the InitialLdapContext that's stored as a property of an LdapAuthenticationToken is
         * transient (because it isn't Serializable), we need some way to recreate the
         * InitialLdapContext if it's null (e.g., if the LdapAuthenticationToken has been serialized
         * and deserialized). This is that mechanism.
         *
         * @param authenticator
         *          the LdapAuthenticator instance from your application's context
         * @param auth
         *          the LdapAuthenticationToken in which to recreate the InitialLdapContext
         * @return
         */

       
static public InitialLdapContext recreateLdapContext(LdapAuthenticator authenticator,
                       
LdapAuthenticationToken auth) {
               
DirContextOperations authAdapter = authenticator.authenticate(auth);
               
InitialLdapContext context = (InitialLdapContext) authAdapter
                               
.getObjectAttribute("ldapContext");
                auth
.setContext(context);
               
return context;
       
}

       
public DefaultSpringSecurityContextSource getContextFactory() {
               
return contextFactory;
       
}

       
/**
         * Set the context factory to use for generating a new LDAP context.
         *
         * @param contextFactory
         */

       
public void setContextFactory(DefaultSpringSecurityContextSource contextFactory) {
               
this.contextFactory = contextFactory;
       
}

       
public String getPrincipalPrefix() {
               
return principalPrefix;
       
}

       
/**
         * Set the string to be prepended to all principal names prior to attempting authentication
         * against the LDAP server.  (For example, if the Active Directory wants the domain-name-plus
         * backslash prepended, use this.)
         *
         * @param principalPrefix
         */

       
public void setPrincipalPrefix(String principalPrefix) {
               
if (principalPrefix != null) {
                       
this.principalPrefix = principalPrefix;
               
} else {
                       
this.principalPrefix = "";
               
}
       
}

}

[LdapAuthenticationToken.java]
/**
 * <p>
 * Authentication token to use when an app needs further access to the LDAP context used to
 * authenticate the user.
 * </p>
 *
 * <p>
 * When this is the Authentication object stored in the Spring Security context, an application
 * can retrieve the current LDAP context thusly:
 * </p>
 *
 * <pre>
 * LdapAuthenticationToken ldapAuth = (LdapAuthenticationToken) SecurityContextHolder
 *              .getContext().getAuthentication();
 * InitialLdapContext ldapContext = ldapAuth.getContext();
 * </pre>
 *
 * @author Jason
 *
 */

public class LdapAuthenticationToken extends AbstractAuthenticationToken {

       
private static final long serialVersionUID = -5040340622950665401L;

       
private Authentication auth;
       
transient private InitialLdapContext context;
       
private List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();

       
/**
         * Construct a new LdapAuthenticationToken, using an existing Authentication object and
         * granting all users a default authority.
         *
         * @param auth
         * @param defaultAuthority
         */

       
public LdapAuthenticationToken(Authentication auth, GrantedAuthority defaultAuthority) {
               
this.auth = auth;
               
if (auth.getAuthorities() != null) {
                       
this.authorities.addAll(Arrays.asList(auth.getAuthorities()));
               
}
               
if (defaultAuthority != null) {
                       
this.authorities.add(defaultAuthority);
               
}
               
super.setAuthenticated(true);
       
}

       
/**
         * Construct a new LdapAuthenticationToken, using an existing Authentication object and
         * granting all users a default authority.
         *
         * @param auth
         * @param defaultAuthority
         */

       
public LdapAuthenticationToken(Authentication auth, String defaultAuthority) {
               
this(auth, new GrantedAuthorityImpl(defaultAuthority));
       
}

       
public GrantedAuthority[] getAuthorities() {
               
GrantedAuthority[] authoritiesArray = this.authorities.toArray(new GrantedAuthority[0]);
               
return authoritiesArray;
       
}

       
public void addAuthority(GrantedAuthority authority) {
               
this.authorities.add(authority);
       
}

       
public Object getCredentials() {
               
return auth.getCredentials();
       
}

       
public Object getPrincipal() {
               
return auth.getPrincipal();
       
}

       
/**
         * Retrieve the LDAP context attached to this user's authentication object.
         *
         * @return the LDAP context
         */

       
public InitialLdapContext getContext() {
               
return context;
       
}

       
/**
         * Attach an LDAP context to this user's authentication object.
         *
         * @param context
         *          the LDAP context
         */

       
public void setContext(InitialLdapContext context) {
               
this.context = context;
       
}

}


'개발자세상' 카테고리의 다른 글

박대연, 그리고 안철수  (1) 2009.09.24
LDAP Query  (0) 2009.09.08
Spring Security 와 Active Directory 연동  (0) 2009.09.01
UML 2.0 과 유스케이스 강의를 듣고  (0) 2009.08.28
RPM 관련 명령  (0) 2009.08.18
Posted by headiron
,

B3 관련하여 본사 AD와 연동을 위해 Spring Security와 AD연동을 테스트 해 보았다.

아래와 같이 spring 설정을 하게 되면 Spring Security는 잘 동작 한다.

이 경우 인증 뿐만 아니라 AD의 그룹기능을 이용하여 Spring Security의 Role도 연동할 수 있게 된다. ( DefaultLdapAuthoritiesPopulator class의 "rolePrefix" 부분을 설정하면 AD의 그룹명 앞에 Prefix를 붙여서 작업할 수 있다. )

하지만 이 경우의 문제점은 AD의 관리자 권한을 가지고 있어야만 된다는 것이다.

여러 모로 생각해 보아도 우리에게 AD 관리자 권한을 열어 줄리는 만무한데...-.-

아래 내용은 http://maniezhilan.blogspot.com/2008/10/spring-security-204-with-active.html 에서 퍼왔음.

[applicationContext-security.xml]
 
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:s="http://www.springframework.org/schema/security"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
 http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
 <s:http>
         <s:intercept-url pattern="/secure/extreme/**" access="ROLE_eCommunications"/>
         <s:intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_REMEMBERED"/>
         <s:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
         <s:form-login/>
         <s:anonymous/>
         <s:logout/>
 </s:http>
 <bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
  <constructor-arg value="ldap://192.168.192.71:3268/DC=dev,DC=247realmedia,DC=co,DC=kr?sAMAccountName?sub?(objectClass=*)"/>
  <property name="userDn" value="CN=kim ducheol,CN=Users,DC=dev,DC=247realmedia,DC=co,DC=kr"/>
  <property name="password" value="XXXXXXX"/>
 </bean>
 <bean id="secondLdapProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
  <s:custom-authentication-provider />
  <constructor-arg>
   <bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
    <constructor-arg ref="contextSource"/>
    <property name="userSearch">
     <bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
      <constructor-arg index="0" value=""/>
      <constructor-arg index="1" value="(&amp;(sAMAccountName={0})(objectclass=user))"/>
      <constructor-arg index="2" ref="contextSource" />
     </bean>    
    </property>
   </bean>
  </constructor-arg>
  <constructor-arg>
   <bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">
    <constructor-arg ref="contextSource" />
    <constructor-arg value="" />
    <property name="rolePrefix" value="ROLE_"/>
    <property name="searchSubtree" value="true"/>
    <property name="convertToUpperCase" value="false"/>
   </bean>
  </constructor-arg>
 </bean>
</beans>

'개발자세상' 카테고리의 다른 글

LDAP Query  (0) 2009.09.08
Spring Security 와 Active Directory 연동 -2  (0) 2009.09.01
UML 2.0 과 유스케이스 강의를 듣고  (0) 2009.08.28
RPM 관련 명령  (0) 2009.08.18
kernel ARG_MAX 값  (0) 2009.05.08
Posted by headiron
,