Skip to content

Commit

Permalink
Remove console log in AuthorizationHandler (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorhdzg authored Feb 21, 2023
1 parent 8b32209 commit ef49ac7
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions Library/AuthorizationHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@ function emptySendRequest(_request: azureCore.PipelineRequest): Promise<azureCor

class AuthorizationHandler {

private _azureTokenPolicy: azureCore.PipelinePolicy;

constructor(credential: azureCoreAuth.TokenCredential) {
let scopes: string[] = [applicationInsightsResource];
this._azureTokenPolicy = azureCore.bearerTokenAuthenticationPolicy({credential, scopes});
}

/**
* Applies the Bearer token to the request through the Authorization header.
*/
public async addAuthorizationHeader(requestOptions: http.RequestOptions | https.RequestOptions): Promise<void> {
let authHeaderName = "authorization";
let webResource = azureCore.createPipelineRequest({ url: "https://" });
await this._azureTokenPolicy.sendRequest(webResource, emptySendRequest);
console.log("#### webResource", webResource);
requestOptions.headers[authHeaderName] = webResource.headers.get(authHeaderName);
}
private _azureTokenPolicy: azureCore.PipelinePolicy;

constructor(credential: azureCoreAuth.TokenCredential) {
let scopes: string[] = [applicationInsightsResource];
this._azureTokenPolicy = azureCore.bearerTokenAuthenticationPolicy({ credential, scopes });
}

/**
* Applies the Bearer token to the request through the Authorization header.
*/
public async addAuthorizationHeader(requestOptions: http.RequestOptions | https.RequestOptions): Promise<void> {
let authHeaderName = "authorization";
let webResource = azureCore.createPipelineRequest({ url: "https://" });
await this._azureTokenPolicy.sendRequest(webResource, emptySendRequest);
requestOptions.headers[authHeaderName] = webResource.headers.get(authHeaderName);
}
}

export = AuthorizationHandler;

0 comments on commit ef49ac7

Please sign in to comment.