import { ServiceClientCredentials } from "../credentials/serviceClientCredentials" ; import { HttpOperationResponse } from "../httpOperationResponse" ; import { WebResourceLike } from "../webResource" ; import { BaseRequestPolicy , RequestPolicyFactory , RequestPolicy , RequestPolicyOptionsLike , } from "./requestPolicy" ; export function signingPolicy ( authenticationProvider ) { return { create : ( nextPolicy , options ) => { return new SigningPolicy ( nextPolicy , options , authenticationProvider ) ; } , } ; } export class SigningPolicy extends BaseRequestPolicy { constructor ( nextPolicy , options , public authenticationProvider ) { super ( nextPolicy , options ) ; } signRequest ( request ) { return this . authenticationProvider . signRequest ( request ) ; } public sendRequest ( request ) { return this . signRequest ( request ) . then ( ( nextRequest ) => this . _nextPolicy . sendRequest ( nextRequest ) ) ; } }