Changeset 36051 in osm for applications
- Timestamp:
- 2023-02-09T14:37:12+01:00 (2 years ago)
- Location:
- applications/editors/josm/plugins/sds
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/sds/build.xml
r35039 r36051 5 5 <property name="commit.message" value=""/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 4153"/>7 <property name="plugin.main.version" value="18650"/> 8 8 9 9 <property name="plugin.author" value="Frederik Ramm"/> -
applications/editors/josm/plugins/sds/src/org/openstreetmap/hot/sds/SdsCredentialAgent.java
r34470 r36051 7 7 import java.net.Authenticator.RequestorType; 8 8 import java.net.PasswordAuthentication; 9 import java.util. HashMap;9 import java.util.EnumMap; 10 10 import java.util.Map; 11 11 12 12 import javax.swing.text.html.HTMLEditorKit; 13 13 14 import org.openstreetmap.josm.data.oauth.IOAuthToken; 14 15 import org.openstreetmap.josm.data.oauth.OAuthToken; 15 16 import org.openstreetmap.josm.gui.io.CredentialDialog; … … 27 28 public class SdsCredentialAgent extends AbstractCredentialsAgent { 28 29 29 Map<RequestorType, PasswordAuthentication> sdsMemoryCredentialsCache = new HashMap<>();30 private final Map<RequestorType, PasswordAuthentication> sdsMemoryCredentialsCache = new EnumMap<>(RequestorType.class); 30 31 31 32 /** 32 * @see CredentialsAgent#lookup(RequestorType) 33 * @see CredentialsAgent#lookup(RequestorType, String) 33 34 */ 34 35 @Override 35 public PasswordAuthentication lookup(RequestorType requestorType, String host) throws CredentialsAgentException{36 public PasswordAuthentication lookup(RequestorType requestorType, String host) { 36 37 if (requestorType == null) 37 38 return null; … … 56 57 57 58 /** 58 * @see CredentialsAgent#store(RequestorType, PasswordAuthentication) 59 * @see CredentialsAgent#store(RequestorType, String, PasswordAuthentication) 59 60 */ 60 61 @Override … … 87 88 * 88 89 * @return the current OAuth Access Token to access the OSM server. 89 * @throws CredentialsAgentException thrown if something goes wrong90 90 */ 91 91 @Override 92 public OAuthToken lookupOAuthAccessToken() throws CredentialsAgentException{92 public OAuthToken lookupOAuthAccessToken() { 93 93 String accessTokenKey = Config.getPref().get("oauth.access-token.key", null); 94 94 String accessTokenSecret = Config.getPref().get("oauth.access-token.secret", null); … … 96 96 return null; 97 97 return new OAuthToken(accessTokenKey, accessTokenSecret); 98 } 99 100 @Override 101 public IOAuthToken lookupOAuthAccessToken(String host) { 102 throw new UnsupportedOperationException("SDS does not support OAuth tokens"); 98 103 } 99 104 … … 123 128 124 129 @Override 125 public void storeOAuthAccessToken(OAuthToken accessToken) 126 throws CredentialsAgentException { 130 public void storeOAuthAccessToken(OAuthToken accessToken) { 127 131 // no-op 128 132 } 133 134 @Override 135 public void storeOAuthAccessToken(String host, IOAuthToken accessToken) { 136 throw new UnsupportedOperationException("SDS does not support OAuth tokens"); 129 137 } 130 138 … … 158 166 * (noSuccessWithLastResponse == true). 159 167 */ 160 } else if (noSuccessWithLastResponse || username.equals( "") || password.equals("")) {161 CredentialDialog dialog = null;168 } else if (noSuccessWithLastResponse || "".equals(username) || "".equals(password)) { 169 CredentialDialog dialog; 162 170 switch(requestorType) { 163 171 case SERVER: … … 167 175 dialog = CredentialDialog.getHttpProxyCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText()); 168 176 break; 177 default: 178 return null; 169 179 } 170 180 dialog.setVisible(true);
Note:
See TracChangeset
for help on using the changeset viewer.