String servicePrincipal = "ldap/" + hostName + "@EXAMPLE.COM";
getLdapServer().setSaslPrincipal( servicePrincipal );
ModifyRequest modifyRequest = new ModifyRequestImpl();
modifyRequest.setName( new Dn( "uid=ldap,ou=users,dc=example,dc=com" ) );
modifyRequest.replace( "userPassword", "randall" );
modifyRequest.replace( "krb5PrincipalName", servicePrincipal );
getService().getAdminSession().modify( modifyRequest );
}