Changeset 18764 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
- Timestamp:
- 2023-06-20T19:40:11+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r18667 r18764 283 283 // these want the OAuth 1.0 token information 284 284 btns.add(new JButton(new RenewAuthorisationAction(AuthorizationProcedure.FULLY_AUTOMATIC))); 285 btns.add(new JButton(new TestAuthorisationAction()));286 }285 } 286 btns.add(new JButton(new TestAuthorisationAction(oAuthVersion))); 287 287 btns.add(new JButton(new RemoveAuthorisationAction())); 288 288 gc.gridy = 4; … … 423 423 */ 424 424 private class TestAuthorisationAction extends AbstractAction { 425 private final OAuthVersion oAuthVersion; 426 425 427 /** 426 428 * Constructs a new {@code TestAuthorisationAction}. 427 429 */ 428 TestAuthorisationAction() { 430 TestAuthorisationAction(OAuthVersion oAuthVersion) { 431 this.oAuthVersion = oAuthVersion; 429 432 putValue(NAME, tr("Test Access Token")); 430 433 putValue(SHORT_DESCRIPTION, tr("Click test access to the OSM server with the current access token")); … … 434 437 @Override 435 438 public void actionPerformed(ActionEvent evt) { 436 OAuthToken token = OAuthAccessTokenHolder.getInstance().getAccessToken(); 437 OAuthParameters parameters = OAuthParameters.createFromApiUrl(OsmApi.getOsmApi().getServerUrl()); 438 TestAccessTokenTask task = new TestAccessTokenTask( 439 OAuthAuthenticationPreferencesPanel.this, 440 apiUrl, 441 parameters, 442 token 443 ); 444 MainApplication.worker.submit(task); 439 if (this.oAuthVersion == OAuthVersion.OAuth10a) { 440 OAuthToken token = OAuthAccessTokenHolder.getInstance().getAccessToken(); 441 OAuthParameters parameters = OAuthParameters.createFromApiUrl(OsmApi.getOsmApi().getServerUrl()); 442 TestAccessTokenTask task = new TestAccessTokenTask( 443 OAuthAuthenticationPreferencesPanel.this, 444 apiUrl, 445 parameters, 446 token 447 ); 448 MainApplication.worker.submit(task); 449 } else { 450 IOAuthToken token = OAuthAccessTokenHolder.getInstance().getAccessToken(OsmApi.getOsmApi().getBaseUrl(), OAuthVersion.OAuth20); 451 TestAccessTokenTask task = new TestAccessTokenTask( 452 OAuthAuthenticationPreferencesPanel.this, 453 apiUrl, 454 token.getParameters(), 455 token 456 ); 457 MainApplication.worker.submit(task); 458 } 445 459 } 446 460 }
Note:
See TracChangeset
for help on using the changeset viewer.
