Getting the http username/password for a part
Koos Vriezen
koos.vriezen at xs4all.nl
Wed Mar 5 21:34:54 GMT 2003
On Wed, 5 Mar 2003, Waldo Bastian wrote:
> Cookies:
> dcop kded kcookiejar findCookies <URL> <WindowId>
> WindowId may be 0
Ok, I give it a try ..
>
> Passwords:
> Did you try "checkAuthInfo" ?
KIO::AuthInfo info;
QString errorMsg;
long s_seqNr = 1;
QCString replyType;
QByteArray params;
QByteArray reply;
KIO::AuthInfo authResult;
//(void) dcopClient(); // Make sure to have a dcop client.
info.url = url;
QDataStream stream(params, IO_WriteOnly);
stream << info << m_view->topLevelWidget()->winId();
if (!kapp->dcopClient ()->call( "kded", "kpasswdserver",
"checkAuthInfo(KIO::AuthInfo, long int)", params, replyType, reply ) ) {
kdWarning() << "Can't communicate with kded_kpasswdserver!" << endl;
} else if ( replyType == "KIO::AuthInfo" ) {
QDataStream stream2( reply, IO_ReadOnly );
stream2 >> authResult >> s_seqNr;
kdDebug() << authResult.username << " " << authResult.password << endl;
}
Tried this, also with s_seqNr=0. The url is the one from openURL, called
by khtml (which is http://localhost/~koos/auth/jsapplet.html).
I get an empty username/password.
Setup is a .htaccess file in ~/public_html/auth/
AuthName "restricted stuff"
AuthType Basic
AuthUserFile /home/koos/public_html/auth/passwd
require valid-user
with a html page that has an applet in this dir. I do get a password
dialog for the html page and page loads fine.
Koos
More information about the kfm-devel
mailing list