Remove core-tiger

Closes gh-621
This commit is contained in:
Josh Cummings
2022-01-21 14:26:22 -07:00
parent f587593fca
commit 7a3e85587a
23 changed files with 22 additions and 1179 deletions

View File

@@ -1,4 +0,0 @@
target
.classpath
.project
.settings

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.3.0.200912170948-RELEASE]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
</configs>
<configSets>
</configSets>
</beansProjectDescription>

View File

@@ -1,15 +0,0 @@
plugins {
id 'io.spring.convention.spring-module'
}
dependencies {
management platform(project(":spring-ldap-dependencies"))
api project(":spring-ldap-core")
api "org.springframework:spring-tx"
testImplementation platform('org.junit:junit-bom')
testImplementation "org.junit.vintage:junit-vintage-engine"
testImplementation "junit:junit"
testImplementation "org.easymock:easymock"
testImplementation "org.assertj:assertj-core"
}

View File

@@ -1,23 +0,0 @@
<assembly>
<id>assembly</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target</directory>
<includes>
<include>*.jar</include>
</includes>
<outputDirectory>dist</outputDirectory>
</fileSet>
<fileSet>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
<outputDirectory>src</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@@ -1,53 +0,0 @@
/*
* Copyright 2005-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.core.simple;
import org.springframework.ldap.core.DirContextOperations;
/**
* Abstract superclass that may be used instead of implementing
* {@link ParameterizedContextMapper} directly. Subclassing from this superclass,
* the supplied context will be automatically cast to
* <code>DirContextOperations</code>. Note that if you use your own
* <code>DirObjectFactory</code>, this implementation will fail with a
* <code>ClassCastException</code>.
*
* @author Mattias Hellborg Arthursson
* @deprecated Core classes are parameterized as of 2.0.
*/
public abstract class AbstractParameterizedContextMapper<T> implements ParameterizedContextMapper<T> {
/*
* (non-Javadoc)
*
* @see org.springframework.ldap.core.ContextMapper#mapFromContext(java.lang.Object)
*/
public final T mapFromContext(Object ctx) {
return doMapFromContext((DirContextOperations) ctx);
}
/**
* Map a single <code>DirContextOperation</code> to an object. The
* supplied instance is the object supplied to
* {@link #mapFromContext(Object)} cast to a
* <code>DirContextOperations</code>.
*
* @param ctx the context to map to an object.
* @return an object built from the data in the context.
*/
protected abstract T doMapFromContext(DirContextOperations ctx);
}

View File

@@ -1,71 +0,0 @@
/*
* Copyright 2005-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.core.simple;
import org.springframework.ldap.core.ContextMapperCallbackHandler;
import org.springframework.ldap.core.ObjectRetrievalException;
import javax.naming.Binding;
import javax.naming.NameClassPair;
import javax.naming.ldap.HasControls;
/**
* Currently only per request controls can be inspected via the post process
* method on a context processor. If a request control gives a different value
* for each search result, then this cannot be inspected using the existing
* support classes. An example control that requires this feature would be
* 1.3.6.1.4.1.42.2.27.9.5.8 Account usability control, that can be used with
* for example the Sun ONE or the OpenDS directory servers.
*
* The extended callback handler can pass hasControls to mapper.
*
* @author Tim Terry
* @author Ulrik Sandberg
* @deprecated use {@link org.springframework.ldap.core.support.ContextMapperCallbackHandlerWithControls} instead.
*/
public class ContextMapperCallbackHandlerWithControls extends ContextMapperCallbackHandler {
private ParameterizedContextMapperWithControls<?> mapper = null;
public ContextMapperCallbackHandlerWithControls(final ParameterizedContextMapperWithControls<?> mapper) {
super(mapper);
this.mapper = mapper;
}
/*
* @see org.springframework.ldap.core.ContextMapperCallbackHandler#
* getObjectFromNameClassPair(javax.naming.NameClassPair)
*/
public Object getObjectFromNameClassPair(final NameClassPair nameClassPair) {
if (!(nameClassPair instanceof Binding)) {
throw new IllegalArgumentException("Parameter must be an instance of Binding");
}
Binding binding = (Binding) nameClassPair;
Object object = binding.getObject();
if (object == null) {
throw new ObjectRetrievalException("Binding did not contain any object.");
}
Object result = null;
if (nameClassPair instanceof HasControls) {
result = mapper.mapFromContextWithControls(object, (HasControls) nameClassPair);
}
else {
result = mapper.mapFromContext(object);
}
return result;
}
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright 2005-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.core.simple;
import org.springframework.ldap.core.ContextMapper;
import javax.naming.Binding;
import javax.naming.directory.SearchResult;
/**
* Extension of the {@link ContextMapper} interface. Uses Java 5 covariant
* return types to override the return type of the
* {@link #mapFromContext(Object)} method to be the type parameter T.
*
* @param <T>
* @deprecated Core classes are parameterized as of 2.0.
*/
public interface ParameterizedContextMapper<T> extends ContextMapper {
/**
* Map a single LDAP Context to an object. The supplied Object
* <code>ctx</code> is the object from a single {@link SearchResult},
* {@link Binding}, or a lookup operation.
*
* @param ctx the context to map to an object.
* @return an object built from the data in the context.
*/
T mapFromContext(Object ctx);
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2005-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.core.simple;
import javax.naming.ldap.HasControls;
/**
* Extension of the {@link ParameterizedContextMapper} interface that allows
* controls to be passed to the mapper implementation. Uses Java 5 covariant
* return types to override the return type of the
* {@link #mapFromContextWithControls(Object, HasControls)} method to be the
* type parameter T.
*
* @author Tim Terry
* @author Ulrik Sandberg
* @param <T> return type of the {@link #mapFromContextWithControls(Object, HasControls)} method.
* @deprecated use {@link org.springframework.ldap.core.support.ContextMapperWithControls} instead.
*/
public interface ParameterizedContextMapperWithControls<T> extends ParameterizedContextMapper<T> {
T mapFromContextWithControls(final Object ctx, final HasControls hasControls);
}

View File

@@ -1,324 +0,0 @@
/*
* Copyright 2005-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.core.simple;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.ldap.NamingException;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.ldap.core.DirContextProcessor;
import org.springframework.ldap.core.LdapOperations;
import javax.naming.Name;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
import java.util.List;
/**
* LDAP operations interface usable on Java 5 and above, exposing a set of
* common LDAP operations.
*
* @author Mattias Hellborg Arthursson
* @deprecated Core classes are parameterized as of 2.0.
*/
public interface SimpleLdapOperations {
/**
* Get the wrapped LdapOperations instance.
*
* @return the wrapped LdapOperations instance.
* @throws NamingException if any error occurs.
*/
LdapOperations getLdapOperations();
/**
* Search for a List of type T using the supplied filter and link
* ParameterizedContextMapper.
*
* @param base Base DN relative to the base of the ContextSource - where to
* start the search.
* @param filter Search filter.
* @param mapper the Mapper to supply all results to.
* @return a List of type T containing objects for all entries found, as
* mapped by the ParameterizedContextMapper.
* @throws NamingException if any error occurs.
*/
<T> List<T> search(String base, String filter,
ParameterizedContextMapper<T> mapper);
/**
* Search for a List of type T using the supplied filter and link
* ParameterizedContextMapper.
*
* @param base Base DN relative to the base of the ContextSource - where to
* start the search.
* @param filter Search filter.
* @param mapper the Mapper to supply all results to.
* @return a List of type T containing objects for all entries found, as
* mapped by the ParameterizedContextMapper.
* @throws NamingException if any error occurs.
* @since 1.3
*/
<T> List<T> search(Name base, String filter,
ParameterizedContextMapper<T> mapper);
/**
* Search for a List of type T using the supplied filter, SearchControls,
* DirContextProcessor and ParameterizedContextMapper.
*
* @param base Base DN relative to the base of the ContextSource - where to
* start the search.
* @param filter Search filter.
* @param controls the SearchControls. Make sure that the returningObjFlag
* is set to <code>true</code>.
* @param mapper the Mapper to supply all results to.
* @param processor the DirContextProcessor to be used for applying pre/post
* processing on the DirContext instance.
* @return a List of type T containing objects for all entries found, as
* mapped by the ParameterizedContextMapper.
* @throws NamingException if any error occurs.
*/
<T> List<T> search(String base, String filter, SearchControls controls,
ParameterizedContextMapper<T> mapper, DirContextProcessor processor);
/**
* Search for a List of type T using the supplied filter, SearchControls,
* DirContextProcessor and ParameterizedContextMapper.
*
* @param base Base DN relative to the base of the ContextSource - where to
* start the search.
* @param filter Search filter.
* @param controls the SearchControls. Make sure that the returningObjFlag
* is set to <code>true</code>.
* @param mapper the Mapper to supply all results to.
* @param processor the DirContextProcessor to be used for applying pre/post
* processing on the DirContext instance.
* @return a List of type T containing objects for all entries found, as
* mapped by the ParameterizedContextMapper.
* @throws NamingException if any error occurs.
* @since 1.3
*/
<T> List<T> search(Name base, String filter, SearchControls controls,
ParameterizedContextMapper<T> mapper, DirContextProcessor processor);
/**
* Perform a lookup of the specified DN and map the result using the mapper.
*
* @param dn the Distinguished Name to look up.
* @param mapper the mapper to use.
* @return the mapped object, as received by the ParameterizedContextMapper.
* @throws NamingException if any error occurs.
*/
<T> T lookup(String dn, ParameterizedContextMapper<T> mapper);
/**
* Perform a lookup of the specified DN and map the result using the mapper.
*
* @param dn the Distinguished Name to look up.
* @param mapper the mapper to use.
* @return the mapped object, as received by the ParameterizedContextMapper.
* @throws NamingException if any error occurs.
* @since 1.3
*/
<T> T lookup(Name dn, ParameterizedContextMapper<T> mapper);
/**
* Perform a search for a unique entry matching the specified search
* criteria and return the found object. If no entry is found or if there
* are more than one matching entry, an
* {@link IncorrectResultSizeDataAccessException} is thrown.
* @param base the DN to use as the base of the search.
* @param filter the search filter.
* @param mapper the mapper to use for the search.
* @return the single object returned by the mapper that matches the search
* criteria.
* @throws IncorrectResultSizeDataAccessException if the result is not one
* unique entry
* @since 1.3
*/
<T> T searchForObject(String base, String filter,
ParameterizedContextMapper<T> mapper);
/**
* Perform a search for a unique entry matching the specified search
* criteria and return the found object. If no entry is found or if there
* are more than one matching entry, an
* {@link IncorrectResultSizeDataAccessException} is thrown.
* @param base the DN to use as the base of the search.
* @param filter the search filter.
* @param mapper the mapper to use for the search.
* @return the single object returned by the mapper that matches the search
* criteria.
* @throws IncorrectResultSizeDataAccessException if the result is not one
* unique entry
* @since 1.3
*/
<T> T searchForObject(Name base, String filter,
ParameterizedContextMapper<T> mapper);
/**
* Look up the specified DN, and automatically cast it to a
* {@link DirContextOperations} instance.
*
* @param dn The Distinguished Name of the entry to look up.
* @return A {@link DirContextOperations} instance constructed from the
* found entry.
* @throws NamingException if any error occurs.
*/
DirContextOperations lookupContext(String dn);
/**
* Look up the specified DN, and automatically cast it to a
* {@link DirContextOperations} instance.
*
* @param dn The Distinguished Name of the entry to look up.
* @return A {@link DirContextOperations} instance constructed from the
* found entry.
* @throws NamingException if any error occurs.
* @since 1.3
*/
DirContextOperations lookupContext(Name dn);
/**
* Create an entry in the LDAP tree. The attributes used to create the entry
* are either retrieved from the <code>obj</code> parameter or the
* <code>attributes</code> parameter (or both). One of these parameters may
* be null but not both.
*
* @param dn The distinguished name to bind the object and attributes to.
* @param obj The object to bind, may be null. Typically a DirContext
* implementation.
* @param attributes The attributes to bind, may be null.
* @throws NamingException if any error occurs.
*/
void bind(String dn, Object obj, Attributes attributes);
/**
* Create an entry in the LDAP tree. The attributes used to create the entry
* are either retrieved from the <code>obj</code> parameter or the
* <code>attributes</code> parameter (or both). One of these parameters may
* be null but not both.
*
* @param dn The distinguished name to bind the object and attributes to.
* @param obj The object to bind, may be null. Typically a DirContext
* implementation.
* @param attributes The attributes to bind, may be null.
* @throws NamingException if any error occurs.
* @since 1.3
*/
void bind(Name dn, Object obj, Attributes attributes);
/**
* Bind the data in the supplied context in the tree. All specified
* Attributes in will be bound to the DN set on the instance.
*
* @param ctx the context to bind
* @throws IllegalStateException if no DN is set or if the instance is in
* update mode.
* @since 1.3
*/
void bind(DirContextOperations ctx);
/**
* Remove an entry from the LDAP tree. The entry must not have any children.
*
* @param dn The distinguished name to unbind.
* @throws NamingException if any error occurs.
*/
void unbind(String dn);
/**
* Remove an entry from the LDAP tree. The entry must not have any children.
*
* @param dn The distinguished name to unbind.
* @throws NamingException if any error occurs.
* @since 1.3
*/
void unbind(Name dn);
/**
* Modify the Attributes of the entry corresponding to the supplied
* {@link DirContextOperations} instance. The instance should have been
* received from the {@link #lookupContext(String)} operation, and then
* modified to match the current state of the matching domain object, e.g.:
*
* <pre>
* public void update(Person person) {
* DirContextOperations ctx = simpleLdapOperations.lookup(person.getDn());
*
* ctx.setAttributeValue(&quot;description&quot;, person.getDescription());
* ctx.setAttributeValue(&quot;telephoneNumber&quot;, person.getPhone());
* // More modifications here
*
* simpleLdapOperations.modifyAttributes(ctx);
* }
* </pre>
*
* @param ctx the entry to update in the LDAP tree.
* @throws NamingException if any error occurs.
*/
void modifyAttributes(DirContextOperations ctx);
/**
* Utility method to perform a simple LDAP 'bind' authentication. Search for
* the LDAP entry to authenticate using the supplied base DN and filter; use
* the DN of the found entry together with the password as input to
* {@link ContextSource#getContext(String, String)}, thus authenticating the
* entry.
* <p>
* Example:<br>
*
* <pre>
* AndFilter filter = new AndFilter();
* filter.and(&quot;objectclass&quot;, &quot;person&quot;).and(&quot;uid&quot;, userId);
* boolean authenticated = ldapTemplate.authenticate(LdapUtils.emptyLdapName(),
* filter.toString(), password);
* </pre>
*
* @param base the DN to use as the base of the search.
* @param filter the search filter - must result in a unique result.
* @param password the password to use for authentication.
* @return <code>true</code> if the authentication was successful,
* <code>false</code> otherwise.
* @since 1.3
*/
boolean authenticate(String base, String filter, String password);
/**
* Utility method to perform a simple LDAP 'bind' authentication. Search for
* the LDAP entry to authenticate using the supplied base DN and filter; use
* the DN of the found entry together with the password as input to
* {@link ContextSource#getContext(String, String)}, thus authenticating the
* entry.
* <p>
* Example:<br>
*
* <pre>
* AndFilter filter = new AndFilter();
* filter.and(&quot;objectclass&quot;, &quot;person&quot;).and(&quot;uid&quot;, userId);
* boolean authenticated = ldapTemplate.authenticate(LdapUtils.emptyLdapName(),
* filter.toString(), password);
* </pre>
*
* @param base the DN to use as the base of the search.
* @param filter the search filter - must result in a unique result.
* @param password the password to use for authentication.
* @return <code>true</code> if the authentication was successful,
* <code>false</code> otherwise.
* @since 1.3
*/
boolean authenticate(Name base, String filter, String password);
}

View File

@@ -1,224 +0,0 @@
/*
* Copyright 2005-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.core.simple;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.ldap.core.DirContextProcessor;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.core.LdapTemplate;
import javax.naming.Name;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
import java.util.List;
/**
* Java-5-based convenience wrapper for the classic LdapTemplate, adding some
* convenient shortcuts and taking advantage of Java 5 Generics.
*
* Use the {@link #getLdapOperations()} method if you need to invoke less
* commonly used template methods.
*
* @author Mattias Hellborg Arthursson
* @deprecated Core classes are parameterized as of 2.0.
*/
public class SimpleLdapTemplate implements SimpleLdapOperations {
private LdapOperations ldapOperations;
/**
* Constructs a new SimpleLdapTemplate instance wrapping the supplied
* LdapOperations instance.
*
* @param ldapOperations the LdapOperations instance to wrap.
*/
public SimpleLdapTemplate(LdapOperations ldapOperations) {
this.ldapOperations = ldapOperations;
}
/**
* Constructs a new SimpleLdapTemplate instance, automatically creating a
* wrapped LdapTemplate instance to work with.
*
* @param contextSource
*/
public SimpleLdapTemplate(ContextSource contextSource) {
this.ldapOperations = new LdapTemplate(contextSource);
}
/**
* {@inheritDoc}
*/
@Override
public LdapOperations getLdapOperations() {
return ldapOperations;
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> T lookup(String dn, ParameterizedContextMapper<T> mapper) {
return (T) ldapOperations.lookup(dn, mapper);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> List<T> search(String base, String filter, ParameterizedContextMapper<T> mapper) {
return ldapOperations.search(base, filter, mapper);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> List<T> search(String base, String filter, SearchControls controls,
ParameterizedContextMapper<T> mapper, DirContextProcessor processor) {
return ldapOperations.search(base, filter, controls, mapper, processor);
}
/**
* {@inheritDoc}
*/
@Override
public DirContextOperations lookupContext(String dn) {
return ldapOperations.lookupContext(dn);
}
/**
* {@inheritDoc}
*/
@Override
public void modifyAttributes(DirContextOperations ctx) {
ldapOperations.modifyAttributes(ctx);
}
/**
* {@inheritDoc}
*/
@Override
public void bind(String dn, Object obj, Attributes attributes) {
ldapOperations.bind(dn, obj, attributes);
}
/**
* {@inheritDoc}
*/
@Override
public void unbind(String dn) {
ldapOperations.unbind(dn);
}
/**
* {@inheritDoc}
*/
@Override
public void bind(Name dn, Object obj, Attributes attributes) {
ldapOperations.bind(dn, obj, attributes);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> T lookup(Name dn, ParameterizedContextMapper<T> mapper) {
return (T) ldapOperations.lookup(dn, mapper);
}
/**
* {@inheritDoc}
*/
@Override
public DirContextOperations lookupContext(Name dn) {
return ldapOperations.lookupContext(dn);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> List<T> search(Name base, String filter, ParameterizedContextMapper<T> mapper) {
return ldapOperations.search(base, filter, mapper);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> List<T> search(Name base, String filter, SearchControls controls, ParameterizedContextMapper<T> mapper,
DirContextProcessor processor) {
return ldapOperations.search(base, filter, controls, mapper, processor);
}
/**
* {@inheritDoc}
*/
@Override
public void unbind(Name dn) {
ldapOperations.unbind(dn);
}
/**
* {@inheritDoc}
*/
@Override
public void bind(DirContextOperations ctx) {
ldapOperations.bind(ctx);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> T searchForObject(String base, String filter, ParameterizedContextMapper<T> mapper) {
return (T) ldapOperations.searchForObject(base, filter, mapper);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> T searchForObject(Name base, String filter, ParameterizedContextMapper<T> mapper) {
return (T) ldapOperations.searchForObject(base, filter, mapper);
}
/**
* {@inheritDoc}
*/
@Override
public boolean authenticate(String base, String filter, String password) {
return ldapOperations.authenticate(base, filter, password);
}
/**
* {@inheritDoc}
*/
@Override
public boolean authenticate(Name base, String filter, String password) {
return ldapOperations.authenticate(base, filter, password);
}
}

View File

@@ -1,8 +0,0 @@
<html>
<body>
Simplification layer over LdapTemplate for Java 5 and above. As of Spring LDAP 2.0 all interfaces and classes
in this package are deprecated.
</body>
</html>

View File

@@ -1,3 +0,0 @@
<body>
This document is the API specification for the Java5-specific parts of the Spring LDAP Framework.
</body>

View File

@@ -1,107 +0,0 @@
/*
* Copyright 2005-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.core.simple;
import org.junit.Before;
import org.junit.Test;
import org.springframework.ldap.core.ObjectRetrievalException;
import javax.naming.Binding;
import javax.naming.NamingException;
import javax.naming.ldap.Control;
import javax.naming.ldap.HasControls;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Unit tests for the {@link ContextMapperCallbackHandlerWithControlsTest}
* class.
*
* @author Ulrik Sandberg
*/
public class ContextMapperCallbackHandlerWithControlsTest {
private ParameterizedContextMapperWithControls<Object> mapperMock;
private ContextMapperCallbackHandlerWithControls tested;
private static class MyBindingThatHasControls extends Binding implements HasControls {
private static final long serialVersionUID = 1L;
public MyBindingThatHasControls(String name, Object obj) {
super(name, obj);
}
public Control[] getControls() throws NamingException {
return null;
}
}
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
mapperMock = createMock(ParameterizedContextMapperWithControls.class);
tested = new ContextMapperCallbackHandlerWithControls(mapperMock);
}
@Test(expected = IllegalArgumentException.class)
public void testConstructorWithEmptyArgument() {
new ContextMapperCallbackHandlerWithControls(null);
}
@Test
public void testGetObjectFromNameClassPair() {
Object expectedObject = "object";
Object expectedResult = "result";
Binding expectedBinding = new Binding("some name", expectedObject);
expect(mapperMock.mapFromContext(expectedObject)).andReturn(expectedResult);
replay(mapperMock);
Object actualResult = tested.getObjectFromNameClassPair(expectedBinding);
verify(mapperMock);
assertThat(actualResult).isEqualTo(expectedResult);
}
@Test
public void testGetObjectFromNameClassPairImplementingHasControls() {
Object expectedObject = "object";
Object expectedResult = "result";
MyBindingThatHasControls expectedBinding = new MyBindingThatHasControls("some name", expectedObject);
expect(mapperMock.mapFromContextWithControls(expectedObject, expectedBinding)).andReturn(expectedResult);
replay(mapperMock);
Object actualResult = tested.getObjectFromNameClassPair(expectedBinding);
verify(mapperMock);
assertThat(actualResult).isEqualTo(expectedResult);
}
@Test(expected = ObjectRetrievalException.class)
public void testGetObjectFromNameClassPairObjectRetrievalException() {
Binding expectedBinding = new Binding("some name", null);
replay(mapperMock);
tested.getObjectFromNameClassPair(expectedBinding);
verify(mapperMock);
}
}

View File

@@ -1,235 +0,0 @@
version: 1
#
#Examples of LDAP Data Interchange Format
#
#
#Example 1: An simple LDAP file with two entries
#
dn: cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Barbara Jensen
cn: Barbara J Jensen
cn: Babs Jensen
sn: Jensen
uid: bjensen
telephonenumber: +1 408 555 1212
description: A big sailing fan.
dn: cn=Bjorn Jensen, ou=Accounting, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Bjorn Jensen
sn: Jensen
telephonenumber: +1 408 555 1212
#
# Example 2: A file containing an entry with a folded attribute value
#
dn:cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com
objectclass:top
objectclass:person
objectclass:organizationalPerson
cn:Barbara Jensen
cn:Barbara J Jensen
cn:Babs Jensen
sn:Jensen
uid:bjensen
telephonenumber:+1 408 555 1212
description:Babs is a big sailing fan, and travels extensively in sea
rch of perfect sailing conditions.
title:Product Manager, Rod and Reel Division
#
# Example 3: A file containing a base-64-encoded value
#
dn: cn=Gern Jensen, ou=Product Testing, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Gern Jensen
cn: Gern O Jensen
sn: Jensen
uid: gernj
telephonenumber: +1 408 555 1212
description:: V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVl
IGlzIGJhc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdG
VyIGluIGl0IChhIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQg
b3V0IG1vcmUu
#
# Example 4: A file containing an entries with UTF-8-encoded attribute
# values, including language tags. Comments indicate the contents
# of UTF-8-encoded attributes and distinguished names.
#
dn:: b3U95Za25qWt6YOoLG89QWlyaXVz
# dn:: ou=<JapaneseOU>,o=Airius
objectclass: top
objectclass: organizationalUnit
ou:: 5Za25qWt6YOo
# ou:: <JapaneseOU>
ou;lang-ja:: 5Za25qWt6YOo
# ou;lang-ja:: <JapaneseOU>
ou;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2
# ou;lang-ja:: <JapaneseOU_in_phonetic_representation>
ou;lang-en: Sales
description: Japanese office
dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz
# dn:: uid=<uid>,ou=<JapaneseOU>,o=Airius
userpassword: {SHA}O3HSv1MusyL4kTjP+HKI5uxuNoM=
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: rogasawara
mail: rogasawara@airius.co.jp
givenname;lang-ja:: 44Ot44OJ44OL44O8
# givenname;lang-ja:: <JapaneseGivenname>
sn;lang-ja:: 5bCP56yg5Y6f
# sn;lang-ja:: <JapaneseSn>
cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
# cn;lang-ja:: <JapaneseCn>
title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw==
# title;lang-ja:: <JapaneseTitle>
preferredlanguage: ja
givenname:: 44Ot44OJ44OL44O8
# givenname:: <JapaneseGivenname>
sn:: 5bCP56yg5Y6f
# sn:: <JapaneseSn>
cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
# cn:: <JapaneseCn>
title:: 5Za25qWt6YOoIOmDqOmVtw==
# title:: <JapaneseTitle>
givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8
# givenname;lang-ja;phonetic::
# <JapaneseGivenname_in_phonetic_representation_kana>
sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ
# sn;lang-ja;phonetic:: <JapaneseSn_in_phonetic_representation_kana>
cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA==
# cn;lang-ja;phonetic:: <JapaneseCn_in_phonetic_representation_kana>
title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg==
# title;lang-ja;phonetic::
# <JapaneseTitle_in_phonetic_representation_kana>
givenname;lang-en: Rodney
sn;lang-en: Ogasawara
cn;lang-en: Rodney Ogasawara
title;lang-en: Sales, Director
#
# Example 5: An LDIF file containing an invalid attribute
#
dn: cn=Harry Jacobs, ou=Product Development, dc=airius, dc=com
objectClass: top
objectClass: person
cn: Harry Jacobs
description: :A big sailing fan.
#
# Example 6: A file containing a reference to an external file
#
dn: cn=Horatio Jensen, ou=Product Testing, dc=airius, dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Horatio Jensen
cn: Horatio N Jensen
sn: Jensen
uid: hjensen
telephonenumber: +1 408 555 1212
jpegphoto:< file:///usr/local/directory/photos/hjensen.jpg
#
# Example 7: A file containing a series of change records and comments
#
# Add a new entry
dn: cn=Fiona Jensen, ou=Marketing, dc=airius, dc=com
changetype: add
objectclass: top
objectclass: person
objectclass: organizationalPerson
cn: Fiona Jensen
sn: Jensen
uid: fiona
telephonenumber: +1 408 555 1212
jpegphoto:< file:///usr/local/directory/photos/fiona.jpg
# Delete an existing entry
dn: cn=Robert Jensen, ou=Marketing, dc=airius, dc=com
changetype: delete
# Modify an entry's relative distinguished name
dn: cn=Paul Jensen, ou=Product Development, dc=airius, dc=com
changetype: modrdn
newrdn: cn=Paula Jensen
deleteoldrdn: 1
# Rename an entry and move all of its children to a new location in
# the directory tree (only implemented by LDAPv3 servers).
dn: ou=PD Accountants, ou=Product Development, dc=airius, dc=com
changetype: modrdn
newrdn: ou=Product Development Accountants
deleteoldrdn: 0
newsuperior: ou=Accounting, dc=airius, dc=com
# Modify an entry: add an additional value to the postaladdress
# attribute, completely delete the description attribute, replace
# the telephonenumber attribute with two values, and delete a specific
# value from the facsimiletelephonenumber attribute
dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
changetype: modify
add: postaladdress
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
-
delete: description
-
replace: telephonenumber
telephonenumber: +1 408 555 1234
telephonenumber: +1 408 555 5678
-
delete: facsimiletelephonenumber
facsimiletelephonenumber: +1 408 555 9876
-
# Modify an entry: replace the postaladdress attribute with an empty
# set of values (which will cause the attribute to be removed), and
# delete the entire description attribute. Note that the first will
# always succeed, while the second will only succeed if at least
# one value for the description attribute is present.
dn: cn=Ingrid Jensen, ou=Product Support, dc=airius, dc=com
changetype: modify
replace: postaladdress
-
delete: description
-
#
# Example 8: An LDIF file containing a change record with a control
#
# Delete an entry. The operation will attach the LDAPv3
# Tree Delete Control defined in [9]. The criticality
# field is "true" and the controlValue field is
# absent, as required by [9].
dn: ou=Product Development, dc=airius, dc=com
control: 1.2.840.113556.1.4.805 true
changetype: delete

View File

@@ -9,7 +9,6 @@ jar {
dependencies {
management platform(project(":spring-ldap-dependencies"))
api project(":spring-ldap-core")
api project(":spring-ldap-core-tiger")
api "org.springframework:spring-core"
implementation "org.freemarker:freemarker"

View File

@@ -23,7 +23,6 @@ dependencyResolutionManagement {
rootProject.name = 'spring-ldap'
include 'core'
include 'core-tiger'
include 'dependencies'
include 'test-support'
include 'ldif/ldif-core'
@@ -50,4 +49,4 @@ rootProject.children.each { p->
p.name = "spring-ldap-" + name
}
findProject(":spring-ldap-test-support").name = "spring-ldap-test"
findProject(":spring-ldap-test-support").name = "spring-ldap-test"

View File

@@ -4,7 +4,7 @@ dependencies {
management platform(project(":spring-ldap-dependencies"))
implementation project(":spring-ldap-test")
implementation project(":spring-ldap-odm")
implementation project(":spring-ldap-core-tiger")
implementation project(":spring-ldap-core")
provided "org.springframework:spring-jdbc"
provided "org.springframework:spring-orm"

View File

@@ -2,7 +2,7 @@ apply plugin: 'io.spring.convention.spring-test'
dependencies {
management platform(project(":spring-ldap-dependencies"))
implementation project(":spring-ldap-core-tiger")
implementation project(":spring-ldap-core")
implementation project(":spring-ldap-test")
implementation "commons-lang:commons-lang"
implementation "commons-logging:commons-logging"

View File

@@ -5,7 +5,7 @@ dependencies {
implementation project(":spring-ldap-test")
implementation project(":spring-ldap-integration-tests")
implementation project(":spring-ldap-sandbox")
implementation project(":spring-ldap-core-tiger")
implementation project(":spring-ldap-core")
implementation "commons-pool:commons-pool"
provided "org.springframework:spring-jdbc"

View File

@@ -18,7 +18,7 @@ sourceSets {
dependencies {
management platform(project(":spring-ldap-dependencies"))
implementation project(":spring-ldap-test"),
project(":spring-ldap-core-tiger")
project(":spring-ldap-core")
implementation "com.querydsl:querydsl-apt",
"commons-lang:commons-lang"

View File

@@ -15,15 +15,23 @@
*/
package org.springframework.ldap.itest.core.simple;
import java.util.List;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.LdapName;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ldap.NameNotFoundException;
import org.springframework.ldap.core.ContextMapper;
import org.springframework.ldap.core.DirContextAdapter;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.ldap.core.DirContextProcessor;
import org.springframework.ldap.core.simple.ParameterizedContextMapper;
import org.springframework.ldap.core.simple.SimpleLdapTemplate;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.filter.AndFilter;
import org.springframework.ldap.filter.EqualsFilter;
import org.springframework.ldap.itest.AbstractLdapTemplateIntegrationTest;
@@ -31,12 +39,6 @@ import org.springframework.ldap.itest.NoAdTest;
import org.springframework.ldap.support.LdapUtils;
import org.springframework.test.context.ContextConfiguration;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.LdapName;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
@@ -47,7 +49,7 @@ public class SimpleLdapTemplateITest extends AbstractLdapTemplateIntegrationTest
private static LdapName DN = LdapUtils.newLdapName("cn=Some Person4,ou=company1,ou=Sweden");
@Autowired
private SimpleLdapTemplate ldapTemplate;
private LdapTemplate ldapTemplate;
@Test
public void testLookup() {
@@ -125,7 +127,7 @@ public class SimpleLdapTemplateITest extends AbstractLdapTemplateIntegrationTest
ldapTemplate.modifyAttributes(ctx);
// verify that the data was properly updated.
ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ParameterizedContextMapper<Object>() {
ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<Object>() {
public Object mapFromContext(Object ctx) {
DirContextAdapter adapter = (DirContextAdapter) ctx;
assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description");
@@ -146,7 +148,7 @@ public class SimpleLdapTemplateITest extends AbstractLdapTemplateIntegrationTest
ldapTemplate.modifyAttributes(ctx);
// verify that the data was properly updated.
ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ParameterizedContextMapper<Object>() {
ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<Object>() {
public Object mapFromContext(Object ctx) {
DirContextAdapter adapter = (DirContextAdapter) ctx;
assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description");
@@ -219,7 +221,7 @@ public class SimpleLdapTemplateITest extends AbstractLdapTemplateIntegrationTest
}
}
private static final class CnContextMapper implements ParameterizedContextMapper<String> {
private static final class CnContextMapper implements ContextMapper<String> {
public String mapFromContext(Object ctx) {
DirContextAdapter adapter = (DirContextAdapter) ctx;

View File

@@ -24,7 +24,7 @@ import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.core.simple.AbstractParameterizedContextMapper;
import org.springframework.ldap.core.support.AbstractContextMapper;
import org.springframework.ldap.core.support.LdapContextSource;
import org.springframework.ldap.filter.EqualsFilter;
import org.springframework.ldap.itest.AbstractLdapTemplateIntegrationTest;
@@ -159,7 +159,7 @@ public class LdapContextSourceIntegrationTest extends AbstractLdapTemplateIntegr
}
}
private final static class DnContextMapper extends AbstractParameterizedContextMapper<String> {
private final static class DnContextMapper extends AbstractContextMapper<String> {
@Override
protected String doMapFromContext(DirContextOperations ctx) {
return ctx.getNameInNamespace();

View File

@@ -7,7 +7,7 @@
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
<bean id="simpleLdapTemplate"
class="org.springframework.ldap.core.simple.SimpleLdapTemplate">
class="org.springframework.ldap.core.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>