Coverage Report - org.apache.maven.wagon.providers.ssh.knownhost.SingleKnownHostProvider
 
Classes in this File Line Coverage Branch Coverage Complexity
SingleKnownHostProvider
0% 
N/A 
1
 
 1  
 package org.apache.maven.wagon.providers.ssh.knownhost;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2005 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *      http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import com.jcraft.jsch.HostKeyRepository;
 20  
 import com.jcraft.jsch.JSch;
 21  
 import com.jcraft.jsch.UserInfo;
 22  
 import org.codehaus.plexus.util.Base64;
 23  
 
 24  
 /**
 25  
  * Simple <code>KnownHostsProvider</code> with known wired values
 26  
  *
 27  
  * @author Juan F. Codagnone
 28  
  * @since Sep 12, 2005
 29  
  */
 30  
 public class SingleKnownHostProvider
 31  
     extends AbstractKnownHostsProvider
 32  
 {
 33  
     /**
 34  
      * the host ...
 35  
      */
 36  
     private String host;
 37  
 
 38  
     /**
 39  
      * the key ...
 40  
      */
 41  
     private String key;
 42  
 
 43  
     public SingleKnownHostProvider()
 44  0
     {
 45  0
     }
 46  
 
 47  
     /**
 48  
      * Creates the SingleKnownHostProvider.
 49  
      */
 50  
     public SingleKnownHostProvider( String host, String key )
 51  0
     {
 52  0
         this.host = host;
 53  0
         this.key = key;
 54  0
     }
 55  
 
 56  
     /**
 57  
      * @see KnownHostsProvider#addKnownHosts(com.jcraft.jsch.JSch, UserInfo)
 58  
      */
 59  
     public void addKnownHosts( JSch sch, UserInfo userInfo )
 60  
     {
 61  0
         HostKeyRepository hkr = sch.getHostKeyRepository();
 62  0
         hkr.add( host, Base64.decodeBase64( key.getBytes() ), userInfo );
 63  0
     }
 64  
 }