Coverage Report - org.apache.maven.wagon.providers.ssh.jsch.WagonUserInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
WagonUserInfo
0 %
0/17
0 %
0/18
1,857
 
 1  
 package org.apache.maven.wagon.providers.ssh.jsch;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import com.jcraft.jsch.UserInfo;
 23  
 import org.apache.maven.wagon.authentication.AuthenticationInfo;
 24  
 import org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo;
 25  
 
 26  
 /**
 27  
  * WagonUserInfo 
 28  
  *
 29  
  * @version $Id: WagonUserInfo.java 658720 2008-05-21 14:49:22Z bentmann $
 30  
  */
 31  
 class WagonUserInfo
 32  
     implements UserInfo
 33  
 {
 34  
     private final InteractiveUserInfo userInfo;
 35  
 
 36  
     private String password;
 37  
 
 38  
     private String passphrase;
 39  
 
 40  
     WagonUserInfo( AuthenticationInfo authInfo, InteractiveUserInfo userInfo )
 41  0
     {
 42  0
         this.userInfo = userInfo;
 43  
 
 44  0
         this.password = authInfo.getPassword();
 45  
 
 46  0
         this.passphrase = authInfo.getPassphrase();
 47  0
     }
 48  
 
 49  
     public String getPassphrase()
 50  
     {
 51  0
         return passphrase;
 52  
     }
 53  
 
 54  
     public String getPassword()
 55  
     {
 56  0
         return password;
 57  
     }
 58  
 
 59  
     public boolean promptPassphrase( String message )
 60  
     {
 61  0
         if ( passphrase == null && userInfo != null )
 62  
         {
 63  0
             passphrase = userInfo.promptPassphrase( message );
 64  
         }
 65  0
         return passphrase != null;
 66  
     }
 67  
 
 68  
     public boolean promptPassword( String message )
 69  
     {
 70  0
         if ( password == null && userInfo != null )
 71  
         {
 72  0
             password = userInfo.promptPassword( message );
 73  
         }
 74  0
         return password != null;
 75  
     }
 76  
 
 77  
     public boolean promptYesNo( String message )
 78  
     {
 79  0
         return userInfo != null && userInfo.promptYesNo( message );
 80  
     }
 81  
 
 82  
     public void showMessage( String message )
 83  
     {
 84  0
         if ( userInfo != null )
 85  
         {
 86  0
             userInfo.showMessage( message );
 87  
         }
 88  0
     }
 89  
 }