我正在尝试通过LDAP帐户进行身份验证:
<?php
$do_not_duplicate = array(); //CREATE EMPTY ARRAY
$loop = new WP_Query( array( 'post_type' => 'products', 'posts_per_page' => -1 ) );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; //FILL ARRAY?>
<?php
$my_post_child_cats = array();
foreach((get_the_category()) as $childcat) {
if (cat_is_ancestor_of(3, $childcat)) { ?>
<?php if ( in_array( $post->ID, $do_not_duplicate ) ) {
do_not_duplicate = array_diff($do_not_duplicate, array($post->ID)); // CHECK ARRAY AND REMOVE ID
?>
<div class="item" data-groups='["all", "<?php echo $childcat->cat_name; ?>"]'>
<div class="pindex">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>">
<div class="pimage">
<?php the_post_thumbnail(); ?>
<div class="pro-title">
<h4><?php echo get_the_title(); ?></h4>
<p>Read more</p></a>
</div>
</div>
<?php } ?>
</div>
</div>
<?php } } } ?>
<?php endwhile; ?>
<?php endif;
wp_reset_postdata();
?>
输入登录页面的用户名和密码后,我得到了:
@Configuration
protected static class AnnotationConfiguration extends GlobalAuthenticationConfigurerAdapter{
@Override
public void init(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception{
authenticationManagerBuilder
.ldapAuthentication()
.userSearchFilter("(cn={0})")
.userSearchBase("ou=User Accounts,dc=ph,dc=sunlife")
//.groupSearchFilter("")
//.userDnPatterns("cn={0},ou=Functional Accounts")
//.rolePrefix("")
.contextSource()
.url("ldap://ldapvs.ph.sun/dc=ph,dc=sun")
.managerPassword("sun_01").managerDn("cn=JPH,ou=Non Internet user,ou=Staff,ou=User Accounts");
}
}
虽然我知道我的密码和用户名是有效的。
答案 0 :(得分:0)
如维基http://wiki.servicenow.com/index.php?title=LDAP_Error_Codes#gsc.tab=0
所述表示Active Directory(AD)AcceptSecurityContext错误,该错误 当用户名有效但密码组合时返回 和用户凭证无效。这是AD的AD等价物 错误代码49。