@@ -299,3 +299,35 @@ describe('WebApi Units', function () {
299
299
assert . equal ( myWebApi . isNoProxyHost ( 'https://my-other-tfs-instance.host/myproject' ) , false ) ;
300
300
} ) ;
301
301
} ) ;
302
+
303
+ describe ( 'Auth Handlers Units' , function ( ) {
304
+ it ( 'cross origin authenthication should be allowed by default in BasicCredentialHandler' , ( ) => {
305
+ const basicAuthHandler = WebApi . getBasicHandler ( 'user' , 'password' ) ;
306
+ assert ( basicAuthHandler [ 'allowCrossOriginAuthentication' ] === true ) ;
307
+ } ) ;
308
+
309
+ it ( 'cross origin authenthication should be allowed by default in BearerCredentialHandler' , ( ) => {
310
+ const bearerAuthHandler = WebApi . getBearerHandler ( '0000000000000000000000000000000000000000' ) ;
311
+ assert ( bearerAuthHandler [ 'allowCrossOriginAuthentication' ] === true ) ;
312
+ } ) ;
313
+
314
+ it ( 'cross origin authenthication should be allowed by default in PersonalAccessTokenCredentialHandler' , ( ) => {
315
+ const personalAccessTokenAuthHandler = WebApi . getPersonalAccessTokenHandler ( '0000000000000000000000000000000000000000' ) ;
316
+ assert ( personalAccessTokenAuthHandler [ 'allowCrossOriginAuthentication' ] === true ) ;
317
+ } ) ;
318
+
319
+ it ( 'cross origin authenthication could be disabled in BasicCredentialHandler' , ( ) => {
320
+ const basicAuthHandler = WebApi . getBasicHandler ( 'user' , 'password' , false ) ;
321
+ assert ( basicAuthHandler [ 'allowCrossOriginAuthentication' ] === false ) ;
322
+ } ) ;
323
+
324
+ it ( 'cross origin authenthication could be disabled in BearerCredentialHandler' , ( ) => {
325
+ const bearerAuthHandler = WebApi . getBearerHandler ( '0000000000000000000000000000000000000000' , false ) ;
326
+ assert ( bearerAuthHandler [ 'allowCrossOriginAuthentication' ] === false ) ;
327
+ } ) ;
328
+
329
+ it ( 'cross origin authenthication could be disabled in PersonalAccessTokenCredentialHandler' , ( ) => {
330
+ const personalAccessTokenAuthHandler = WebApi . getPersonalAccessTokenHandler ( '0000000000000000000000000000000000000000' , false ) ;
331
+ assert ( personalAccessTokenAuthHandler [ 'allowCrossOriginAuthentication' ] === false ) ;
332
+ } ) ;
333
+ } ) ;
0 commit comments