| 1 |
Credentials storage duration |
| 2 |
============================ |
| 3 |
How long credentials are stored depends on a couple of factors. The first is |
| 4 |
whether a window-id (see QWidget::WId) was provided when the password request |
| 5 |
was made. The other is the state of KIO::AuthInfo's keepPassword flag. |
| 6 |
|
| 7 |
If the window-id parameter is missing, the credentials are stored for the |
| 8 |
entire duration of the current KDE session. Otherwise, they are only kept |
| 9 |
until the application(s) associated with the window-id exit. |
| 10 |
|
| 11 |
The "keepPassword" flag on the other hand only matters for caching credentials |
| 12 |
in a persistent storage such as KWallet. If this flag is set to false, then |
| 13 |
credentials are only kept in memory based on the value of window-id as discussed |
| 14 |
above. See the documentation for the "keepPassword" property in KIO::AuthInfo |
| 15 |
for more details. |
| 16 |
|
| 17 |
Dawit A. <[email protected]> |
| 18 |
|
| 19 |
Sequence numbers |
| 20 |
================ |
| 21 |
The idea is that whenever the user is queried for a password this |
| 22 |
login/pw combination gets a seq-nr. When a worker needs a login/pw |
| 23 |
it asks kpasswdserver and sends along the last seqnr it received. If |
| 24 |
this seqnr is older (lower) than the seq nr of the login/pw |
| 25 |
combination stored in kpasswdserver then apparently the user has |
| 26 |
already been prompted for a new login/pw combination since the last |
| 27 |
time this worker asked for a login/pw and therefore it is not necessary |
| 28 |
to prompt the user again but kpassword will send the KIO worker this |
| 29 |
new login/pw combination. If this new combination fails as well the |
| 30 |
user is being prompted for a new login/pw combo since the one stored |
| 31 |
in kpasswdserver doesn't work. |
| 32 |
|
| 33 |
Let me try to draw the situation I had in mind when writing this: |
| 34 |
|
| 35 |
Worker1 Worker2 kpasswdserver |
| 36 |
Asks for auth |
| 37 |
asks user for login/pw (1) |
| 38 |
sends login/pw (1) to ftp site |
| 39 |
Asks for auth |
| 40 |
sends back login/pw (1) |
| 41 |
sends login/pw (1) to ftp site |
| 42 |
gets login error, |
| 43 |
asks for new auth |
| 44 |
sends along seq.nr 1 |
| 45 |
seq.nr 1 == (1) --> |
| 46 |
asks user for new login/pw (2) |
| 47 |
sends login/pw (2) to ftp site |
| 48 |
gets login error, |
| 49 |
asks for new auth |
| 50 |
sends along seq.nr 1 |
| 51 |
seq.nr 1 < (2) --> |
| 52 |
don't ask user for new login/pw |
| 53 |
but send back login/pw (2) without asking |
| 54 |
sends login/pw (2) to ftp site |
| 55 |
|
| 56 |
|
| 57 |
Actually, I had mostly http in mind, and not so much ftp. In http you |
| 58 |
typically try without password first, and only when you get an |
| 59 |
authentication error you ask for a password. The above scenario is |
| 60 |
then suddenly a lot more common than with ftp because it can happen |
| 61 |
that you have 4 requests /workers who all discover at about the |
| 62 |
same time that they need to have authentication credentials. The |
| 63 |
above scenario (and the seq. nrs) is to prevent that you get 4 login |
| 64 |
dialogs in such case. |
| 65 |
|
| 66 |
Now the assumption in this all, looking back on it, seems to be that |
| 67 |
when you ask for the same auth credentials twice in a row, it must be |
| 68 |
that the credentials issued the first time where wrong, and you will |
| 69 |
be prompted again. But if the user goes to ftp-site1, then |
| 70 |
ftp-site2 and then back to ftp-site1 again, the credentials for ftp-site1 |
| 71 |
are still valid. This is why we reset the seq.nr stored in the KIO worker |
| 72 |
to 0 whenever the KIO worker switches hosts (or logins). |
| 73 |
|
| 74 |
Waldo Bastian <[email protected]> |