A forum thread in the YPN section of DigitalPoint Forums asks; Does Yahoo Publisher work for password-protected pages?
If the YPN or Google spiders can not fetch the page, then they can not understand what your content is about. I see it all the time. If a page requires password login, like test servers or private forums and so on, and the pages have AdSense or YPN ads on them, you will notice that they most likely do not serve up as that are contextually relevant to the page.
Google normally will serve up PSAs (Public Service Ads) and Yahoo! Publisher Network would most likely serve up RON (Run of Network Ads). It is possible they serve up ads based on the site's theme, but more often then not, I see that not to be the case.
Forum discussion at DigitalPoint Forums.