Skip to content

Commit d9e479a

Browse files
author
Anatoly Bolshakov
authored
Merge pull request #420 from anatolybolshakov/users/anatolybolshakov/allowCrossOriginAuthentication_fix
Passed allowCrossOriginAuthentication to BasicCredentialHandler constructor - to fix authorization issue
2 parents dcf730b + ad301b1 commit d9e479a

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

api/WebApi.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,28 @@ const isBrowser: boolean = typeof window !== 'undefined';
4747
* Methods to return handler objects (see handlers folder)
4848
*/
4949

50-
export function getBasicHandler(username: string, password: string): VsoBaseInterfaces.IRequestHandler {
51-
return new basicm.BasicCredentialHandler(username, password);
50+
export function getBasicHandler(username: string, password: string, allowCrossOriginAuthentication?: boolean): VsoBaseInterfaces.IRequestHandler {
51+
return new basicm.BasicCredentialHandler(username, password, allowCrossOriginAuthentication);
5252
}
5353

5454
export function getNtlmHandler(username: string, password: string, workstation?: string, domain?: string): VsoBaseInterfaces.IRequestHandler {
5555
return new ntlmm.NtlmCredentialHandler(username, password, workstation, domain);
5656
}
5757

58-
export function getBearerHandler(token: string): VsoBaseInterfaces.IRequestHandler {
59-
return new bearm.BearerCredentialHandler(token);
58+
export function getBearerHandler(token: string, allowCrossOriginAuthentication?: boolean): VsoBaseInterfaces.IRequestHandler {
59+
return new bearm.BearerCredentialHandler(token, allowCrossOriginAuthentication);
6060
}
6161

62-
export function getPersonalAccessTokenHandler(token: string): VsoBaseInterfaces.IRequestHandler {
63-
return new patm.PersonalAccessTokenCredentialHandler(token);
62+
export function getPersonalAccessTokenHandler(token: string, allowCrossOriginAuthentication?: boolean): VsoBaseInterfaces.IRequestHandler {
63+
return new patm.PersonalAccessTokenCredentialHandler(token, allowCrossOriginAuthentication);
6464
}
6565

66-
export function getHandlerFromToken(token: string): VsoBaseInterfaces.IRequestHandler {
66+
export function getHandlerFromToken(token: string, allowCrossOriginAuthentication?: boolean): VsoBaseInterfaces.IRequestHandler {
6767
if (token.length === 52) {
68-
return getPersonalAccessTokenHandler(token);
68+
return getPersonalAccessTokenHandler(token, allowCrossOriginAuthentication);
6969
}
7070
else {
71-
return getBearerHandler(token);
71+
return getBearerHandler(token, allowCrossOriginAuthentication);
7272
}
7373
}
7474

api/handlers/basiccreds.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ifm = require('../interfaces/common/VsoBaseInterfaces');
55
import * as resthandlers from 'typed-rest-client/Handlers';
66

77
export class BasicCredentialHandler extends resthandlers.BasicCredentialHandler implements ifm.IRequestHandler {
8-
constructor(username: string, password: string) {
9-
super(username, password);
8+
constructor(username: string, password: string, allowCrossOriginAuthentication?: boolean) {
9+
super(username, password, allowCrossOriginAuthentication);
1010
}
1111
}

api/handlers/bearertoken.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ifm = require('../interfaces/common/VsoBaseInterfaces');
55
import * as resthandlers from 'typed-rest-client/Handlers';
66

77
export class BearerCredentialHandler extends resthandlers.BearerCredentialHandler implements ifm.IRequestHandler {
8-
constructor(token: string) {
9-
super(token);
8+
constructor(token: string, allowCrossOriginAuthentication?: boolean) {
9+
super(token, allowCrossOriginAuthentication);
1010
}
1111
}

api/handlers/personalaccesstoken.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ifm = require('../interfaces/common/VsoBaseInterfaces');
55
import * as resthandlers from 'typed-rest-client/Handlers';
66

77
export class PersonalAccessTokenCredentialHandler extends resthandlers.PersonalAccessTokenCredentialHandler implements ifm.IRequestHandler {
8-
constructor(token: string) {
9-
super(token);
8+
constructor(token: string, allowCrossOriginAuthentication?: boolean) {
9+
super(token, allowCrossOriginAuthentication);
1010
}
1111
}

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azure-devops-node-api",
33
"description": "Node client for Azure DevOps and TFS REST APIs",
4-
"version": "10.1.1",
4+
"version": "10.1.2",
55
"main": "./WebApi.js",
66
"types": "./WebApi.d.ts",
77
"scripts": {
@@ -25,7 +25,7 @@
2525
"license": "MIT",
2626
"dependencies": {
2727
"tunnel": "0.0.6",
28-
"typed-rest-client": "^1.7.3",
28+
"typed-rest-client": "^1.8.0",
2929
"underscore": "1.8.3"
3030
},
3131
"devDependencies": {

0 commit comments

Comments
 (0)