Skip to content

Commit

Permalink
Added new way of obtaining access token, fixed API calls (#21408)
Browse files Browse the repository at this point in the history
Signed-off-by: Tibor Dancs <tdancs@redhat.com>
  • Loading branch information
ScrewTSW authored May 19, 2022
1 parent 9209044 commit f02f353
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/e2e/utils/requestHandlers/CheApiRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class CheApiRequestHandler {
return request;
}
request_censored.headers.Authorization = 'CENSORED';
request_censored.headers.Cookie = 'CENSORED';
Logger.info(`RequestHandler request:\n` + request_censored);
} catch (err) {
Logger.error(`RequestHandler request: Failed to deep clone AxiosRequestConfig:` + err);
Expand Down Expand Up @@ -69,6 +70,7 @@ export class CheApiRequestHandler {
return response;
}
response_censored.config.headers.Authorization = 'CENSORED';
response_censored.config.headers.Cookie = 'CENSORED';
if (response_censored.data.access_token != null) {
response_censored.data.access_token = 'CENSORED';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
**********************************************************************/
import { AxiosRequestConfig } from 'axios';
import { IAuthorizationHeaderHandler } from './IAuthorizationHeaderHandler';
import { injectable } from 'inversify';
import { inject, injectable } from 'inversify';
import { DriverHelper } from '../../DriverHelper';
import { CLASSES } from '../../../inversify.types';

@injectable()
export class CheMultiuserAuthorizationHeaderHandler implements IAuthorizationHeaderHandler {
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }

async get(): Promise<AxiosRequestConfig> {
// to-do : Fetch the cookies from user api and pass it here
return { headers: { 'cookie': `` } };
let token = await this.driverHelper.getDriver().manage().getCookie('_oauth_proxy');
return { headers: { 'cookie': `_oauth_proxy=${token.value}` } };
}
}

0 comments on commit f02f353

Please sign in to comment.