| 48 | * Applies http authentication to the request context. |
| 49 | */ |
| 50 | export class RestApiKeyAuthentication implements SecurityAuthentication { |
| 51 | /** |
| 52 | * Configures the http authentication with the required details. |
| 53 | * |
| 54 | * @param tokenProvider service that can provide the up-to-date token when needed |
| 55 | */ |
| 56 | public constructor(private tokenProvider: TokenProvider) {} |
| 57 | |
| 58 | public getName(): string { |
| 59 | return "rest_api_key"; |
| 60 | } |
| 61 | |
| 62 | public async applySecurityAuthentication(context: RequestContext) { |
| 63 | context.setHeaderParam("Authorization", "Key " + await this.tokenProvider.getToken()); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | |
| 68 | export type AuthMethods = { |
nothing calls this directly
no outgoing calls
no test coverage detected