Ignore:
Timestamp:
2017-10-14T00:09:56+02:00 (14 months ago)
Author:
Don-vip
Message:

fix #15435 - do not cache incorrect login credentials when using basic auth

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java

    r12869 r12992  
    6262
    6363        /*
    64          * Last request was successful and there was no credentials stored
    65          * in file (or only the username is stored).
    66          * -> Try to recall credentials that have been entered
    67          * manually in this session.
     64         * Last request was successful and there was no credentials stored in file (or only the username is stored).
     65         * -> Try to recall credentials that have been entered manually in this session.
    6866         */
    6967        if (!noSuccessWithLastResponse && memoryCredentialsCache.containsKey(requestorType) &&
     
    8987                        response.getPassword()
    9088                ));
    91             /*
    92              * User decides not to save credentials to file. Keep it
    93              * in memory so we don't have to ask over and over again.
    94              */
    9589            } else {
    96                 PasswordAuthentication pa = new PasswordAuthentication(response.getUsername(), response.getPassword());
    97                 memoryCredentialsCache.put(requestorType, pa);
     90                // User decides not to save credentials to file. Keep it in memory so we don't have to ask over and over again.
     91                memoryCredentialsCache.put(requestorType, new PasswordAuthentication(response.getUsername(), response.getPassword()));
    9892            }
    99         /*
    100          * We got it from file.
    101          */
    10293        } else {
     94            // We got it from file.
    10395            response.setUsername(username);
    10496            response.setPassword(password.toCharArray());
     
    10698        }
    10799        return response;
     100    }
     101
     102    @Override
     103    public final void purgeCredentialsCache(RequestorType requestorType) {
     104        memoryCredentialsCache.remove(requestorType);
    108105    }
    109106
Note: See TracChangeset for help on using the changeset viewer.