spring ldap에선 기본이 Context.SECURITY_AUTHENTICATION 이 simple 이다.
그래서 아래와 같이 만들고
[code java] public class DigestMD5DirContextAuthenticationStrategy implementsDirContextAuthenticationStrategy {
/*
* (non-Javadoc)
* @see org.springframework.ldap.core.support.DirContextAuthenticationStrategy#setupEnvironment(java.util.Hashtable,
* java.lang.String, java.lang.String)
*/
public void setupEnvironment(Hashtable env, String userDn, String password) {
env.put(Context.SECURITY_AUTHENTICATION, "DIGEST-MD5");
env.put(Context.SECURITY_PRINCIPAL, userDn);
env.put(Context.SECURITY_CREDENTIALS, password);
} /*
* (non-Javadoc)
* @see org.springframework.ldap.core.support.DirContextAuthenticationStrategy#processContextAfterCreation(javax.naming.directory.DirContext,
* java.lang.String, java.lang.String)
*/
public DirContext processContextAfterCreation(DirContext ctx, String userDn, String password) {
return ctx; }
} [/code]
아래와 같이 설정하면 된다.
[code xml] <bean id="digestMD5DirContextAuthenticationStrategy" class="common.ldap.DigestMD5DirContextAuthenticationStrategy"/><bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
<constructor-arg value="연결정보">
<property name="userDn" value="정보" />
<property name="password" value="정보" />
<property name="authenticationStrategy" ref="digestMD5DirContextAuthenticationStrategy" />
</bean>
[/code]
위와 같이 하면 된다.
댓글 없음:
댓글 쓰기