@@ -195,19 +195,34 @@ public void CanCloneWithCredentials()
195
195
}
196
196
}
197
197
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
+
198
216
[ 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 )
201
220
{
202
221
var scd = BuildSelfCleaningDirectory ( ) ;
203
222
204
223
string clonedRepoPath = Repository . Clone ( url , scd . DirectoryPath , new CloneOptions ( )
205
224
{
206
- CredentialsProvider = ( _url , _user , _cred ) => new UsernamePasswordCredentials
207
- {
208
- Username = user ,
209
- Password = pass ,
210
- }
225
+ CredentialsProvider = ( _url , _user , _cred ) => CreateUsernamePasswordCredentials ( user , pass , secure )
211
226
} ) ;
212
227
213
228
using ( var repo = new Repository ( clonedRepoPath ) )
0 commit comments