Changeset 27367 in osm for applications/editors


Ignore:
Timestamp:
2011-12-31T01:16:15+01:00 (13 years ago)
Author:
stoecker
Message:

fix #josm7180 - build issues

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  
    3333    <property name="commit.message" value="Commit message"/>
    3434    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    35     <property name="plugin.main.version" value="4549"/>
     35    <property name="plugin.main.version" value="4692"/>
    3636
    3737    <!--
  • applications/editors/josm/plugins/native-password-manager/src/org/openstreetmap/josm/plugins/npm/InitializationWizard.java

    r26459 r27367  
    4747import org.openstreetmap.josm.io.auth.CredentialsAgentException;
    4848import org.openstreetmap.josm.io.auth.CredentialsManager;
     49import org.openstreetmap.josm.io.OsmApi;
    4950import org.openstreetmap.josm.tools.ImageProvider;
    5051import org.openstreetmap.josm.tools.PlatformHookOsx;
     
    354355            if (server_username != null || server_password != null) {
    355356                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)));
    357358                    if (rbClear.isSelected()) {
    358359                        Main.pref.put("osm-server.username", null);
     
    366367            String proxy_username = Main.pref.get(ProxyPreferencesPanel.PROXY_USER, null);
    367368            String proxy_password = Main.pref.get(ProxyPreferencesPanel.PROXY_PASS, null);
     369            String proxy_host = Main.pref.get(ProxyPreferencesPanel.PROXY_HTTP_HOST, null);
    368370            if (proxy_username != null || proxy_password != null) {
    369371                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)));
    371373                    if (rbClear.isSelected()) {
    372374                        Main.pref.put(ProxyPreferencesPanel.PROXY_USER, null);
  • applications/editors/josm/plugins/native-password-manager/src/org/openstreetmap/josm/plugins/npm/NPMCredentialsAgent.java

    r26509 r27367  
    2121import org.openstreetmap.josm.gui.preferences.server.ProxyPreferencesPanel;
    2222import org.openstreetmap.josm.gui.widgets.HtmlPanel;
     23import org.openstreetmap.josm.io.OsmApi;
    2324import org.openstreetmap.josm.io.auth.AbstractCredentialsAgent;
    2425import org.openstreetmap.josm.io.auth.CredentialsAgentException;
     
    9596   
    9697    @Override
    97     public PasswordAuthentication lookup(RequestorType rt) throws CredentialsAgentException {
     98    public PasswordAuthentication lookup(RequestorType rt, String host) throws CredentialsAgentException {
    9899        PasswordAuthentication cache = credentialsCache.get(rt);
    99100        if (cache != null)
     
    104105        switch(rt) {
    105106            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                }
    108114                auth = new PasswordAuthentication(user, password == null ? new char[0] : password);
    109115                break;
     
    120126
    121127    @Override
    122     public void store(RequestorType rt, PasswordAuthentication credentials) throws CredentialsAgentException {
     128    public void store(RequestorType rt, String host, PasswordAuthentication credentials) throws CredentialsAgentException {
    123129        char[] username, password;
    124130        if (credentials == null) {
     
    136142        switch(rt) {
    137143            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                }
    141153                break;
    142154            case PROXY:
Note: See TracChangeset for help on using the changeset viewer.