Changeset 18671 in josm


Ignore:
Timestamp:
2023-02-21T16:15:39+01:00 (21 months ago)
Author:
taylor.smock
Message:

See #20768: Ensure that removing an OAuth 1.0 token actually removes the token

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/oauth/OAuthAccessTokenHolder.java

    r18650 r18671  
    121121     */
    122122    public IOAuthToken getAccessToken(String api, OAuthVersion version) {
    123         api = URI.create(api).getHost();
    124         if (this.tokenMap.containsKey(api)) {
     123        // Sometimes the api might be sent as the host
     124        api = Optional.ofNullable(URI.create(api).getHost()).orElse(api);
     125        if (this.tokenMap.containsKey(api) && this.tokenMap.get(api).containsKey(version)) {
    125126            Map<OAuthVersion, IOAuthToken> map = this.tokenMap.get(api);
    126127            return map.get(version);
     
    236237                if (this.accessTokenKey != null && this.accessTokenSecret != null) {
    237238                    cm.storeOAuthAccessToken(new OAuthToken(accessTokenKey, accessTokenSecret));
     239                } else {
     240                    cm.storeOAuthAccessToken(null);
    238241                }
    239242                for (Map.Entry<String, Map<OAuthVersion, IOAuthToken>> entry : this.tokenMap.entrySet()) {
Note: See TracChangeset for help on using the changeset viewer.