Changeset 11194 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-10-30T18:14:52+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #13872 - use authentication only if OAuth is configured properly

File:
1 edited

Legend:

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

    r11193 r11194  
    1616import org.openstreetmap.josm.data.osm.DataSet;
    1717import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     18import org.openstreetmap.josm.io.auth.CredentialsAgentException;
     19import org.openstreetmap.josm.io.auth.CredentialsManager;
    1820import org.openstreetmap.josm.tools.HttpClient;
    1921
     
    2931public abstract class OsmServerReader extends OsmConnection {
    3032    private final OsmApi api = OsmApi.getOsmApi();
    31     private boolean doAuthenticate = OsmApi.isUsingOAuth();
     33    private boolean doAuthenticate;
    3234    protected boolean gpxParsedProperly;
     35
     36    /**
     37     * Constructs a new {@code OsmServerReader}.
     38     */
     39    public OsmServerReader() {
     40        try {
     41            doAuthenticate = OsmApi.isUsingOAuth() && CredentialsManager.getInstance().lookupOAuthAccessToken() != null;
     42        } catch (CredentialsAgentException e) {
     43            Main.warn(e);
     44        }
     45    }
    3346
    3447    /**
Note: See TracChangeset for help on using the changeset viewer.