Ignore:
Timestamp:
2017-10-14T00:09:56+02:00 (12 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/OsmApi.java

    r12846 r12992  
    99import java.io.StringReader;
    1010import java.io.StringWriter;
     11import java.net.Authenticator.RequestorType;
    1112import java.net.ConnectException;
    1213import java.net.HttpURLConnection;
     
    3334import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    3435import org.openstreetmap.josm.io.Capabilities.CapabilitiesParser;
     36import org.openstreetmap.josm.io.auth.CredentialsManager;
    3537import org.openstreetmap.josm.spi.preferences.Config;
    3638import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    704706                    else
    705707                        throw new OsmApiException(retCode, errorHeader, errorBody);
     708                case HttpURLConnection.HTTP_UNAUTHORIZED:
    706709                case HttpURLConnection.HTTP_FORBIDDEN:
    707                     OsmApiException e = new OsmApiException(retCode, errorHeader, errorBody);
    708                     e.setAccessedUrl(activeConnection.getURL().toString());
    709                     throw e;
     710                    CredentialsManager.getInstance().purgeCredentialsCache(RequestorType.SERVER);
     711                    throw new OsmApiException(retCode, errorHeader, errorBody, activeConnection.getURL().toString(),
     712                            doAuthenticate ? retrieveBasicAuthorizationLogin(client) : null);
    710713                default:
    711714                    throw new OsmApiException(retCode, errorHeader, errorBody);
Note: See TracChangeset for help on using the changeset viewer.