Fix issue #18308

Fix issue #18308 by adding a retry mechanism in validate_windows_cred fuction.