On Fri, Apr 20, 2012 at 8:13 PM, Dawit A <ada...@kde.org> wrote:
> Though this is documented in multiple places, it might not be apparent to a
> lot of developers as I have encountered and addressed this issue in multiple
> places recently.
>
> If you are using KIO in your application and you want user provided
> credentials to be cached for the duration of your application, you need to
> make sure you call KIO::JobUiDelegate::setWindow once you obtain an instance
> of a KIO job. You set the main window through the KIO::JobUiDelegate
> instance provided by KIO::Job itself (see KIO::Job::ui()):
>
> KIO::TransferJob* job = KIO::get(url);
> job->ui()->setWindow(widget->window());
>
> Unless you do that, any credential requested from the user will only be
> cached for approx. 10 secs. When that time expires, the user will be
> prompted to enter those credentials again. BTW, this also applies to other
> classes like KDirLister as well. In case of KDirLister, you have to do the
> following:
>
> KDirLister* lister = new KDirLister;
> lister->setMainWindow(widget->window());
>
> So, the next time a user complains about being required to login credentials
> over and over again when using your application, check your code to make
> sure it is doing the right thing.
>
> Regards,
> Dawit A.

Is there a situation where someone would want to cache credentials for
only 10 seconds?  If not, should there be a warning of even a build
failure if a program tries to do that?  Maybe a warning now and a
failure under frameworks?  If there is a need for caching credentials
without a window perhaps a different API with finer-grained control of
the caching would be better.

-Todd

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to