30 changed files with 770 additions and 18 deletions
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
apply plugin: 'io.spring.convention.spring-test' |
||||
|
||||
dependencies { |
||||
compile project(':spring-security-core') |
||||
compile 'org.springframework:spring-beans' |
||||
compile 'org.springframework:spring-context' |
||||
compile 'org.springframework:spring-core' |
||||
compile 'org.springframework:spring-tx' |
||||
compile project(':spring-security-config') |
||||
compile project(':spring-security-ldap') |
||||
|
||||
runtime apachedsDependencies |
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/* |
||||
* Copyright 2002-2019 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.security; |
||||
|
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext; |
||||
import org.springframework.security.config.BeanIds; |
||||
import org.springframework.security.ldap.server.ApacheDSContainer; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
/** |
||||
* @author Eddú Meléndez |
||||
*/ |
||||
public class LdapServerBeanDefinitionParserTests { |
||||
|
||||
private ClassPathXmlApplicationContext context; |
||||
|
||||
@Before |
||||
public void setup() { |
||||
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); |
||||
} |
||||
|
||||
@After |
||||
public void closeAppContext() { |
||||
if (this.context != null) { |
||||
this.context.close(); |
||||
this.context = null; |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void apacheDirectoryServerIsStartedByDefault() { |
||||
String[] beanNames = this.context.getBeanNamesForType(ApacheDSContainer.class); |
||||
assertThat(beanNames).hasSize(1); |
||||
assertThat(beanNames[0]).isEqualTo(BeanIds.EMBEDDED_APACHE_DS); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<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 https://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd"> |
||||
|
||||
<s:ldap-server ldif="classpath:users.ldif"/> |
||||
|
||||
</beans> |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
dn: ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: groups |
||||
|
||||
dn: ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: people |
||||
|
||||
dn: uid=rod,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Rod Johnson |
||||
sn: Johnson |
||||
uid: rod |
||||
userPassword: koala |
||||
|
||||
dn: uid=dianne,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Dianne Emu |
||||
sn: Emu |
||||
uid: dianne |
||||
userPassword: emu |
||||
|
||||
dn: uid=scott,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Scott |
||||
sn: Wombat |
||||
uid: scott |
||||
userPassword: wombat |
||||
|
||||
dn: cn=user,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: user |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
member: uid=scott,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=teller,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: teller |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=supervisor,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: supervisor |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
apply plugin: 'io.spring.convention.spring-test' |
||||
|
||||
dependencies { |
||||
compile project(':spring-security-core') |
||||
compile 'org.springframework:spring-beans' |
||||
compile 'org.springframework:spring-context' |
||||
compile 'org.springframework:spring-core' |
||||
compile 'org.springframework:spring-tx' |
||||
compile project(':spring-security-config') |
||||
compile project(':spring-security-ldap') |
||||
|
||||
runtime apachedsDependencies |
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/* |
||||
* Copyright 2002-2019 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.security; |
||||
|
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext; |
||||
import org.springframework.security.config.BeanIds; |
||||
import org.springframework.security.ldap.server.ApacheDSContainer; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
/** |
||||
* @author Eddú Meléndez |
||||
*/ |
||||
public class LdapServerBeanDefinitionParserTests { |
||||
|
||||
private ClassPathXmlApplicationContext context; |
||||
|
||||
@Before |
||||
public void setup() { |
||||
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); |
||||
} |
||||
|
||||
@After |
||||
public void closeAppContext() { |
||||
if (this.context != null) { |
||||
this.context.close(); |
||||
this.context = null; |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void apacheDirectoryServerIsStartedByDefault() { |
||||
String[] beanNames = this.context.getBeanNamesForType(ApacheDSContainer.class); |
||||
assertThat(beanNames).hasSize(1); |
||||
assertThat(beanNames[0]).isEqualTo(BeanIds.EMBEDDED_APACHE_DS); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<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 https://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd"> |
||||
|
||||
<s:ldap-server mode="apacheds" ldif="classpath:users.ldif"/> |
||||
|
||||
</beans> |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
dn: ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: groups |
||||
|
||||
dn: ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: people |
||||
|
||||
dn: uid=rod,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Rod Johnson |
||||
sn: Johnson |
||||
uid: rod |
||||
userPassword: koala |
||||
|
||||
dn: uid=dianne,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Dianne Emu |
||||
sn: Emu |
||||
uid: dianne |
||||
userPassword: emu |
||||
|
||||
dn: uid=scott,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Scott |
||||
sn: Wombat |
||||
uid: scott |
||||
userPassword: wombat |
||||
|
||||
dn: cn=user,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: user |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
member: uid=scott,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=teller,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: teller |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=supervisor,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: supervisor |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
apply plugin: 'io.spring.convention.spring-test' |
||||
|
||||
dependencies { |
||||
compile project(':spring-security-core') |
||||
compile 'org.springframework:spring-beans' |
||||
compile 'org.springframework:spring-context' |
||||
compile 'org.springframework:spring-core' |
||||
compile 'org.springframework:spring-tx' |
||||
compile project(':spring-security-config') |
||||
compile project(':spring-security-ldap') |
||||
|
||||
testCompile "com.unboundid:unboundid-ldapsdk" |
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/* |
||||
* Copyright 2002-2019 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.security; |
||||
|
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext; |
||||
import org.springframework.security.config.BeanIds; |
||||
import org.springframework.security.ldap.server.UnboundIdContainer; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
/** |
||||
* @author Eddú Meléndez |
||||
*/ |
||||
public class LdapServerBeanDefinitionParserTests { |
||||
|
||||
private ClassPathXmlApplicationContext context; |
||||
|
||||
@Before |
||||
public void setup() { |
||||
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); |
||||
} |
||||
|
||||
@After |
||||
public void closeAppContext() { |
||||
if (this.context != null) { |
||||
this.context.close(); |
||||
this.context = null; |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void apacheDirectoryServerIsStartedByDefault() { |
||||
String[] beanNames = this.context.getBeanNamesForType(UnboundIdContainer.class); |
||||
assertThat(beanNames).hasSize(1); |
||||
assertThat(beanNames[0]).isEqualTo(BeanIds.EMBEDDED_UNBOUNDID); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<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 https://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd"> |
||||
|
||||
<s:ldap-server mode="unboundid" ldif="classpath:users.ldif"/> |
||||
|
||||
</beans> |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
dn: ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: groups |
||||
|
||||
dn: ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: people |
||||
|
||||
dn: uid=rod,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Rod Johnson |
||||
sn: Johnson |
||||
uid: rod |
||||
userPassword: koala |
||||
|
||||
dn: uid=dianne,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Dianne Emu |
||||
sn: Emu |
||||
uid: dianne |
||||
userPassword: emu |
||||
|
||||
dn: uid=scott,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Scott |
||||
sn: Wombat |
||||
uid: scott |
||||
userPassword: wombat |
||||
|
||||
dn: cn=user,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: user |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
member: uid=scott,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=teller,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: teller |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=supervisor,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: supervisor |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
apply plugin: 'io.spring.convention.spring-test' |
||||
|
||||
dependencies { |
||||
compile project(':spring-security-core') |
||||
compile 'org.springframework:spring-beans' |
||||
compile 'org.springframework:spring-context' |
||||
compile 'org.springframework:spring-core' |
||||
compile 'org.springframework:spring-tx' |
||||
compile project(':spring-security-config') |
||||
compile project(':spring-security-ldap') |
||||
} |
||||
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
/* |
||||
* Copyright 2002-2019 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.security; |
||||
|
||||
import org.junit.After; |
||||
import org.junit.Rule; |
||||
import org.junit.Test; |
||||
import org.junit.rules.ExpectedException; |
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException; |
||||
import org.springframework.context.support.ClassPathXmlApplicationContext; |
||||
|
||||
/** |
||||
* @author Eddú Meléndez |
||||
*/ |
||||
public class LdapServerBeanDefinitionParserTests { |
||||
|
||||
@Rule |
||||
public ExpectedException thrown = ExpectedException.none(); |
||||
|
||||
private ClassPathXmlApplicationContext context; |
||||
|
||||
@After |
||||
public void closeAppContext() { |
||||
if (this.context != null) { |
||||
this.context.close(); |
||||
this.context = null; |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void apacheDirectoryServerIsStartedByDefault() { |
||||
this.thrown.expect(BeanDefinitionStoreException.class); |
||||
this.thrown.expectMessage("Embedded LDAP server is not provided"); |
||||
|
||||
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<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 https://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd"> |
||||
|
||||
<s:ldap-server ldif="classpath:users.ldif"/> |
||||
|
||||
</beans> |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
dn: ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: groups |
||||
|
||||
dn: ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: people |
||||
|
||||
dn: uid=rod,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Rod Johnson |
||||
sn: Johnson |
||||
uid: rod |
||||
userPassword: koala |
||||
|
||||
dn: uid=dianne,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Dianne Emu |
||||
sn: Emu |
||||
uid: dianne |
||||
userPassword: emu |
||||
|
||||
dn: uid=scott,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Scott |
||||
sn: Wombat |
||||
uid: scott |
||||
userPassword: wombat |
||||
|
||||
dn: cn=user,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: user |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
member: uid=scott,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=teller,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: teller |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=supervisor,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: supervisor |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
apply plugin: 'io.spring.convention.spring-test' |
||||
|
||||
dependencies { |
||||
compile project(':spring-security-core') |
||||
compile 'org.springframework:spring-beans' |
||||
compile 'org.springframework:spring-context' |
||||
compile 'org.springframework:spring-core' |
||||
compile 'org.springframework:spring-tx' |
||||
compile project(':spring-security-config') |
||||
compile project(':spring-security-ldap') |
||||
|
||||
testCompile "com.unboundid:unboundid-ldapsdk" |
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/* |
||||
* Copyright 2002-2019 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.security; |
||||
|
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext; |
||||
import org.springframework.security.config.BeanIds; |
||||
import org.springframework.security.ldap.server.UnboundIdContainer; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
/** |
||||
* @author Eddú Meléndez |
||||
*/ |
||||
public class LdapServerBeanDefinitionParserTests { |
||||
|
||||
private ClassPathXmlApplicationContext context; |
||||
|
||||
@Before |
||||
public void setup() { |
||||
this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); |
||||
} |
||||
|
||||
@After |
||||
public void closeAppContext() { |
||||
if (this.context != null) { |
||||
this.context.close(); |
||||
this.context = null; |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void apacheDirectoryServerIsStartedByDefault() { |
||||
String[] beanNames = this.context.getBeanNamesForType(UnboundIdContainer.class); |
||||
assertThat(beanNames).hasSize(1); |
||||
assertThat(beanNames[0]).isEqualTo(BeanIds.EMBEDDED_UNBOUNDID); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<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 https://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd"> |
||||
|
||||
<s:ldap-server ldif="classpath:users.ldif"/> |
||||
|
||||
</beans> |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
dn: ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: groups |
||||
|
||||
dn: ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: organizationalUnit |
||||
ou: people |
||||
|
||||
dn: uid=rod,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Rod Johnson |
||||
sn: Johnson |
||||
uid: rod |
||||
userPassword: koala |
||||
|
||||
dn: uid=dianne,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Dianne Emu |
||||
sn: Emu |
||||
uid: dianne |
||||
userPassword: emu |
||||
|
||||
dn: uid=scott,ou=people,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: person |
||||
objectclass: organizationalPerson |
||||
objectclass: inetOrgPerson |
||||
cn: Scott |
||||
sn: Wombat |
||||
uid: scott |
||||
userPassword: wombat |
||||
|
||||
dn: cn=user,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: user |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
member: uid=scott,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=teller,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: teller |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
member: uid=dianne,ou=people,dc=springframework,dc=org |
||||
|
||||
dn: cn=supervisor,ou=groups,dc=springframework,dc=org |
||||
objectclass: top |
||||
objectclass: groupOfNames |
||||
cn: supervisor |
||||
member: uid=rod,ou=people,dc=springframework,dc=org |
||||
Loading…
Reference in new issue