Package hudson.scm.SubversionSCM.DescriptorImpl

Examples of hudson.scm.SubversionSCM.DescriptorImpl.Credential


      SubversionSCM.DescriptorImpl subversionDescriptor = (SubversionSCM.DescriptorImpl)getSCMDescriptor();
      try {
        Field credentialField = SubversionSCM.DescriptorImpl.class.getDeclaredField("credentials");
        credentialField.setAccessible(true);
        Map<String,Credential> credentials = (Map<String,Credential>)credentialField.get(subversionDescriptor);
        Credential cred = credentials.get(realm);
        if(cred == null){
          LOGGER.severe("No credentials are stored in Hudson for realm ["+realm+"] !");
          return null;
        }
        String kind = ISVNAuthenticationManager.PASSWORD;
        if(scmUrl.startsWith("svn+ssh")){
          kind = ISVNAuthenticationManager.SSH;
        }
        return createSCMCredentialConfiguration(cred.createSVNAuthentication(kind));
      } catch (SecurityException e) {
        LOGGER.log(Level.SEVERE, "'credentials' field not readable on SubversionSCM.DescriptorImpl !");
      } catch (NoSuchFieldException e) {
        LOGGER.log(Level.SEVERE, "'credentials' field not readable on SubversionSCM.DescriptorImpl !");
      } catch (IllegalArgumentException e) {
View Full Code Here


            LOGGER.log(INFO,"Failed to persist the credentials",e);
        }
    }

    public synchronized void acknowledge(String realm, Credential cred) throws IOException {
        Credential old = cred==null ? credentials.remove(realm) : credentials.put(realm, cred);
        // save only if there was a change
        if (old==null && cred==null)    return;
        if (old==null || cred==null || !old.equals(cred))
            save();
    }
View Full Code Here

TOP

Related Classes of hudson.scm.SubversionSCM.DescriptorImpl.Credential

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.