Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * ====================================================================
   * Copyright (c) 2004-2006 TMate Software Ltd.  All rights reserved.
   *
   * This software is licensed as described in the file COPYING, which
   * you should have received as part of this distribution.  The terms
   * are also available at http://svnkit.com/license.html
   * If newer versions of this license are posted there, you may use a
   * newer version instead, at your option.
  * ====================================================================
  */
 package org.tmatesoft.svn.core.internal.wc;
 
 import java.io.File;
 import java.net.URL;
 import java.util.Map;
 
 import  org.eclipse.core.runtime.CoreException;
 import  org.eclipse.core.runtime.Platform;

Author(s):
TMate Software Ltd.
Version:
1.1.0
 
 
     private static URL DEFAULT_URL;
     
     static {
         try {
              = new URL("http://tmate.org/svn/");
         } catch (MalformedURLException e) {            
         }
     }
 
     public EclipseSVNAuthenticationManager(File configDirectoryboolean storeAuthString userNameString passwordFile keyFileString passphrase) {
         super(configDirectorystoreAuthuserNamepasswordkeyFilepassphrase);
     }
 
         return new KeyringAuthenticationProvider();
     }
 
     protected ISVNAuthenticationProvider createDefaultAuthenticationProvider(String userNameString passwordFile privateKeyString passphraseboolean allowSave) {
         return new ISVNAuthenticationProvider() {
             public SVNAuthentication requestClientAuthentication(String kindSVNURL urlString realmSVNErrorMessage errorMessageSVNAuthentication previousAuthboolean authMayBeStored) {
                 return null;
             }
             public int acceptServerAuthentication(SVNURL urlString realmObject certificateboolean resultMayBeStored) {
                 return ;
             }
         };
     }
     
 
         public SVNAuthentication requestClientAuthentication(String kindSVNURL urlString realmSVNErrorMessage errorMessageSVNAuthentication previousAuthboolean authMayBeStored) {
             // get from key-ring, use realm.
             realm = realm == null ? .toString() : realm;
             Map info = Platform.getAuthorizationInfo(realmkind);
             // convert info to SVNAuthentication.
             if (info != null && ..equals(kind)) {
                 String path = (Stringinfo.get("cert");
                 String password = (Stringinfo.get("password");
                 if (path != null) {
                     return new SVNSSLAuthentication(new File(path), passwordauthMayBeStored);
                 }
             } else if (info != null && !info.isEmpty() && info.get("username") != null) {
                 if (..equals(kind)) {
                     return new SVNPasswordAuthentication((Stringinfo.get("username"), (Stringinfo.get("password"), authMayBeStored);
                 } else if (..equals(kind)) {
                     int port = url.getPort();
                     if (port < 0 && info.get("port") != null) {
                         port = Integer.parseInt((Stringinfo.get("port"));
                     }
                     if (port < 0) {
                         port = 22;
                     }
                     if (info.get("key") != null) {
                         File keyPath = new File((Stringinfo.get("key"));
                         return new SVNSSHAuthentication((Stringinfo.get("username"), keyPath, (Stringinfo.get("passphrase"), portauthMayBeStored);
                     } else if (info.get("password") != null) {
                         return new SVNSSHAuthentication((Stringinfo.get("username"), (Stringinfo.get("password"), portauthMayBeStored);
                     }
                 } else if (..equals(kind)) {
                     return new SVNUserNameAuthentication((Stringinfo.get("username"), authMayBeStored);
                 }
             }
            return null;
        }
        public int acceptServerAuthentication(SVNURL urlString realmObject certificateboolean resultMayBeStored) {
            return ;
        }
        public void saveAuthentication(SVNAuthentication authString kindString realm) {
            if (!(auth instanceof SVNSSLAuthentication) && (auth.getUserName() == null || "".equals(auth.getUserName()))) {
                return;
            }
            realm = realm == null ? .toString() : realm;
            Map info = new HashMap();
            // convert info to SVNAuthentication.
            info.put("username"auth.getUserName());
            if (auth instanceof SVNPasswordAuthentication) {
                info.put("password", ((SVNPasswordAuthenticationauth).getPassword());
            } else if (auth instanceof SVNSSHAuthentication) {
                SVNSSHAuthentication sshAuth = (SVNSSHAuthenticationauth;
                if (sshAuth.getPrivateKeyFile() != null) {
                    info.put("key"sshAuth.getPrivateKeyFile().getAbsolutePath());
                    if (sshAuth.getPassphrase() != null) {
                        info.put("passphrase"sshAuth.getPassphrase());
                    }
                } else if (sshAuth.getPassword() != null) {
                    info.put("password"sshAuth.getPassword());
                }
                if (sshAuth.getPortNumber() >= 0) {
                    info.put("port", Integer.toString(sshAuth.getPortNumber()));
                }
            } else if (auth instanceof SVNSSLAuthentication) {
                SVNSSLAuthentication sslAuth = (SVNSSLAuthenticationauth;
                File path = sslAuth.getCertificateFile();
                String password = sslAuth.getPassword();
                if (path != null) {
                    info.put("cert"path.getAbsolutePath());
                    if (password != null && !"".equals(password)) {
                        info.put("password"password);
                    }
                }
            }
            try {
                Platform.addAuthorizationInfo(realmkindinfo);
            } catch (CoreException e) {
            }
        }
    
    }
New to GrepCode? Check out our FAQ X