Changeset 27367 in osm
- Timestamp:
- 2011-12-31T01:16:15+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/native-password-manager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/native-password-manager/build.xml
r27119 r27367 33 33 <property name="commit.message" value="Commit message"/> 34 34 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 35 <property name="plugin.main.version" value="4 549"/>35 <property name="plugin.main.version" value="4692"/> 36 36 37 37 <!-- -
applications/editors/josm/plugins/native-password-manager/src/org/openstreetmap/josm/plugins/npm/InitializationWizard.java
r26459 r27367 47 47 import org.openstreetmap.josm.io.auth.CredentialsAgentException; 48 48 import org.openstreetmap.josm.io.auth.CredentialsManager; 49 import org.openstreetmap.josm.io.OsmApi; 49 50 import org.openstreetmap.josm.tools.ImageProvider; 50 51 import org.openstreetmap.josm.tools.PlatformHookOsx; … … 354 355 if (server_username != null || server_password != null) { 355 356 try { 356 cm.store(RequestorType.SERVER, new PasswordAuthentication(string(server_username), toCharArray(server_password)));357 cm.store(RequestorType.SERVER, OsmApi.getOsmApi().getHost(), new PasswordAuthentication(string(server_username), toCharArray(server_password))); 357 358 if (rbClear.isSelected()) { 358 359 Main.pref.put("osm-server.username", null); … … 366 367 String proxy_username = Main.pref.get(ProxyPreferencesPanel.PROXY_USER, null); 367 368 String proxy_password = Main.pref.get(ProxyPreferencesPanel.PROXY_PASS, null); 369 String proxy_host = Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST, null); 368 370 if (proxy_username != null || proxy_password != null) { 369 371 try { 370 cm.store(RequestorType.PROXY, new PasswordAuthentication(string(proxy_username), toCharArray(proxy_password)));372 cm.store(RequestorType.PROXY, proxy_host, new PasswordAuthentication(string(proxy_username), toCharArray(proxy_password))); 371 373 if (rbClear.isSelected()) { 372 374 Main.pref.put(ProxyPreferencesPanel.PROXY_USER, null); -
applications/editors/josm/plugins/native-password-manager/src/org/openstreetmap/josm/plugins/npm/NPMCredentialsAgent.java
r26509 r27367 21 21 import org.openstreetmap.josm.gui.preferences.server.ProxyPreferencesPanel; 22 22 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 23 import org.openstreetmap.josm.io.OsmApi; 23 24 import org.openstreetmap.josm.io.auth.AbstractCredentialsAgent; 24 25 import org.openstreetmap.josm.io.auth.CredentialsAgentException; … … 95 96 96 97 @Override 97 public PasswordAuthentication lookup(RequestorType rt ) throws CredentialsAgentException {98 public PasswordAuthentication lookup(RequestorType rt, String host) throws CredentialsAgentException { 98 99 PasswordAuthentication cache = credentialsCache.get(rt); 99 100 if (cache != null) … … 104 105 switch(rt) { 105 106 case SERVER: 106 user = stringNotNull(getProvider().read(getServerDescriptor()+".username")); 107 password = getProvider().read(getServerDescriptor()+".password"); 107 if(OsmApi.getOsmApi().getHost().equals(host)) { 108 user = stringNotNull(getProvider().read(getServerDescriptor()+".username")); 109 password = getProvider().read(getServerDescriptor()+".password"); 110 } else { 111 user = stringNotNull(getProvider().read(host+".username")); 112 password = getProvider().read(host+".password"); 113 } 108 114 auth = new PasswordAuthentication(user, password == null ? new char[0] : password); 109 115 break; … … 120 126 121 127 @Override 122 public void store(RequestorType rt, PasswordAuthentication credentials) throws CredentialsAgentException {128 public void store(RequestorType rt, String host, PasswordAuthentication credentials) throws CredentialsAgentException { 123 129 char[] username, password; 124 130 if (credentials == null) { … … 136 142 switch(rt) { 137 143 case SERVER: 138 prefix = getServerDescriptor(); 139 usernameDescription = tr("JOSM/OSM API/Username"); 140 passwordDescription = tr("JOSM/OSM API/Password"); 144 if(OsmApi.getOsmApi().getHost().equals(host)) { 145 prefix = getServerDescriptor(); 146 usernameDescription = tr("JOSM/OSM API/Username"); 147 passwordDescription = tr("JOSM/OSM API/Password"); 148 } else { 149 prefix = host; 150 usernameDescription = tr("{0}/Username", host); 151 passwordDescription = tr("{0}/Password", host); 152 } 141 153 break; 142 154 case PROXY:
Note:
See TracChangeset
for help on using the changeset viewer.