本文整理汇总了Java中org.jasig.cas.util.LdapTestUtils类的典型用法代码示例。如果您正苦于以下问题:Java LdapTestUtils类的具体用法?Java LdapTestUtils怎么用?Java LdapTestUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LdapTestUtils类属于org.jasig.cas.util包,在下文中一共展示了LdapTestUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParameters
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> getParameters() {
return Arrays.asList(new Object[][] {
{
LdapTestUtils.DirectoryType.ActiveDirectory,
false,
new String[] {"/ldap-provision-context.xml", "/ad-authn-test.xml"},
},
{
LdapTestUtils.DirectoryType.OpenLdap,
true,
new String[] {"/ldap-provision-context.xml", "/openldap-searchbind-authn-test.xml"},
},
{
LdapTestUtils.DirectoryType.OpenLdap,
true,
new String[] {"/ldap-provision-context.xml", "/openldap-anonsearchbind-authn-test.xml"},
},
{
LdapTestUtils.DirectoryType.OpenLdap,
false,
new String[] {"/ldap-provision-context.xml", "/openldap-directbind-authn-test.xml"},
},
});
}
示例2: testAuthenticateSuccess
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@Test
public void testAuthenticateSuccess() throws Exception {
String username;
for (final LdapEntry entry : this.testEntries) {
username = getUsername(entry);
final HandlerResult result = this.handler.authenticate(
new UsernamePasswordCredential(username, LdapTestUtils.getPassword(entry)));
assertNotNull(result.getPrincipal());
assertEquals(username, result.getPrincipal().getId());
assertEquals(
entry.getAttribute("displayName").getStringValue(),
result.getPrincipal().getAttributes().get("displayName"));
assertEquals(
entry.getAttribute("mail").getStringValue(),
result.getPrincipal().getAttributes().get("mail"));
}
}
示例3: setUp
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
// Environment check
this.enableLdapTests = System.getProperty("enableLdapTests") != null;
Assume.assumeTrue("enableLdapTests system property not set", this.enableLdapTests);
this.context = new ClassPathXmlApplicationContext(this.contextPaths);
this.baseDn = this.context.getBean("baseDn", String.class);
this.usersLdif = this.context.getBean("usersLdif", Resource.class);
this.usernameAttribute = this.context.getBean("usernameAttribute", String.class);
this.provisioningConnectionFactory = this.context.getBean(
"provisioningConnectionFactory", ConnectionFactory.class);
this.testEntries = LdapTestUtils.readLdif(this.usersLdif, this.baseDn);
final Connection connection = getConnection();
try {
connection.open();
LdapTestUtils.createLdapEntries(connection, this.directoryType, this.testEntries);
} finally {
LdapUtils.closeConnection(connection);
}
}
示例4: LdapAuthenticationHandlerTests
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
public LdapAuthenticationHandlerTests(
final LdapTestUtils.DirectoryType directoryType,
final boolean supportsNotFound,
final String ... contextPaths) {
this.directoryType = directoryType;
this.supportsNotFound = supportsNotFound;
this.contextPaths = contextPaths;
}
示例5: tearDown
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
if (!this.enableLdapTests) {
return;
}
final Connection connection = getConnection();
try {
connection.open();
LdapTestUtils.removeLdapEntries(connection, this.testEntries);
} finally {
LdapUtils.closeConnection(connection);
}
}
示例6: getParameters
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> getParameters() {
return Arrays.asList(new Object[][]{
{
LdapTestUtils.DirectoryType.OpenLdap,
new String[]{"/ldap-provision-context.xml", "/openldap-userdetails-test.xml"},
},
});
}
示例7: setUp
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
this.groupsLdif = context.getBean("groupsLdif", Resource.class);
this.groupEntries = LdapTestUtils.readLdif(this.groupsLdif, this.baseDn);
final Connection connection = getConnection();
try {
connection.open();
LdapTestUtils.createLdapEntries(connection, this.directoryType, this.groupEntries);
} finally {
connection.close();
}
this.userDetailsService = this.context.getBean(LdapUserDetailsService.class);
}
示例8: tearDown
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
super.tearDown();
if (!this.enableLdapTests) {
return;
}
final Connection connection = getConnection();
try {
connection.open();
LdapTestUtils.removeLdapEntries(connection, this.groupEntries);
} finally {
connection.close();
}
}
示例9: getParameters
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
@Parameterized.Parameters
public static Collection<Object[]> getParameters() {
return Arrays.asList(new Object[][]{
{
LdapTestUtils.DirectoryType.OpenLdap,
new String[]{"/ldap-provision-context.xml", "/openldap-persondir-test.xml"},
},
});
}
示例10: populateEntries
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
protected void populateEntries(final LDAPConnection c, final InputStream rs) throws Exception {
this.ldapEntries = LdapTestUtils.readLdif(rs, getBaseDn());
LdapTestUtils.createLdapEntries(c, ldapEntries);
populateEntriesInternal(c);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:6,代码来源:InMemoryTestLdapDirectoryServer.java
示例11: LdapUserDetailsServiceTests
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
public LdapUserDetailsServiceTests(
final LdapTestUtils.DirectoryType directoryType, final String ... contextPaths) {
this.directoryType = directoryType;
this.contextPaths = contextPaths;
}
示例12: LdapPersonAttributeDaoTests
import org.jasig.cas.util.LdapTestUtils; //导入依赖的package包/类
public LdapPersonAttributeDaoTests(
final LdapTestUtils.DirectoryType directoryType, final String ... contextPaths) {
this.directoryType = directoryType;
this.contextPaths = contextPaths;
}