@@ -195,19 +195,34 @@ public void CanCloneWithCredentials()
195195 }
196196 }
197197
198+ static Credentials CreateUsernamePasswordCredentials ( string user , string pass , bool secure )
199+ {
200+ if ( secure )
201+ {
202+ return new SecureUsernamePasswordCredentials
203+ {
204+ Username = user ,
205+ Password = Constants . StringToSecureString ( pass ) ,
206+ } ;
207+ }
208+
209+ return new UsernamePasswordCredentials
210+ {
211+ Username = user ,
212+ Password = pass ,
213+ } ;
214+ }
215+
198216 [ Theory ]
199- [ InlineData ( "https://libgit2@bitbucket.org/libgit2/testgitrepository.git" , "libgit3" , "libgit3" ) ]
200- public void CanCloneFromBBWithCredentials ( string url , string user , string pass )
217+ [ InlineData ( "https://libgit2@bitbucket.org/libgit2/testgitrepository.git" , "libgit3" , "libgit3" , true ) ]
218+ [ InlineData ( "https://libgit2@bitbucket.org/libgit2/testgitrepository.git" , "libgit3" , "libgit3" , false ) ]
219+ public void CanCloneFromBBWithCredentials ( string url , string user , string pass , bool secure )
201220 {
202221 var scd = BuildSelfCleaningDirectory ( ) ;
203222
204223 string clonedRepoPath = Repository . Clone ( url , scd . DirectoryPath , new CloneOptions ( )
205224 {
206- CredentialsProvider = ( _url , _user , _cred ) => new UsernamePasswordCredentials
207- {
208- Username = user ,
209- Password = pass ,
210- }
225+ CredentialsProvider = ( _url , _user , _cred ) => CreateUsernamePasswordCredentials ( user , pass , secure )
211226 } ) ;
212227
213228 using ( var repo = new Repository ( clonedRepoPath ) )
0 commit comments