- Timestamp:
- 2026-10-06T09:00:18+02:00 (10 days ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
-
data/oauth/OAuthParameters.java (modified) (1 diff)
-
io/OsmConnection.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
r19627 r19638 263 263 return remembered; 264 264 } 265 return createDefault(apiUrl, oAuthVersion); 265 // Use the URL as it was given: apiUrl is the host by now, which is never a valid URL, so 266 // createDefault() would silently fall back to the API currently configured in the preferences. 267 return createDefault(originalApiUrl, oAuthVersion); 266 268 default: 267 269 throw new IllegalArgumentException("Unknown OAuth version: " + oAuthVersion); -
trunk/src/org/openstreetmap/josm/io/OsmConnection.java
r19536 r19638 34 34 import org.openstreetmap.josm.tools.JosmRuntimeException; 35 35 import org.openstreetmap.josm.tools.Logging; 36 import org.openstreetmap.josm.tools.Utils; 36 37 37 38 /** … … 147 148 */ 148 149 private void obtainOAuth20Token() throws MissingOAuthAccessTokenException { 150 if (Utils.isEmpty(this.oAuth20Parameters.getClientId())) { 151 // Without a client id the authorization request is rejected by the server with "Missing required 152 // parameter: client_id", so do not send the user to the browser at all. The message of the exception 153 // is for the log only; what the user is shown already points at the preferences, which is where the 154 // client id of an OAuth application registered on this server has to be entered. 155 throw new MissingOAuthAccessTokenException( 156 "No OAuth client id for " + OsmApi.getOsmApi().getServerUrl() + ", cannot request a token"); 157 } 149 158 if (!Boolean.TRUE.equals(GuiHelper.runInEDTAndWaitAndReturn(() -> 150 159 ConditionalOptionPaneUtil.showConfirmationDialog("oauth.oauth20.obtain.automatically", … … 201 210 protected void addOAuth20AuthorizationHeader(HttpClient connection) throws OsmTransferException { 202 211 if (this.oAuth20Parameters == null) { 203 this.oAuth20Parameters = OAuthParameters.createFromApiUrl(connection.getURL().getHost(), OAuthVersion.OAuth20); 212 // The parameters are stored under the API URL, so look them up with the API URL and not with the 213 // host of the request: OAuthParameters.createFromApiUrl() reduces it to the host itself where that 214 // is what it needs. 215 this.oAuth20Parameters = OAuthParameters.createFromApiUrl(OsmApi.getOsmApi().getServerUrl(), OAuthVersion.OAuth20); 204 216 } 205 217 OAuthAccessTokenHolder holder = OAuthAccessTokenHolder.getInstance();
Note:
See TracChangeset
for help on using the changeset viewer.
