C# Class Akamai.EdgeGrid.Auth.EdgeGridV1Signer

The EdgeGrid Signer is responsible for brokering a requests.This class is responsible for the core interaction logic given an API command and the associated set of parameters. When event is executed, the 'Authorization' header is decorated If connection is going to be reused, pass the persistent HttpWebRequest object when calling execute() TODO: support rebinding on IO communication errors (eg: connection reset) TODO: support Async callbacks and Async IO TODO: support multiplexing TODO: optimize and adapt throughput based on connection latency Author: [email protected] (Colin Bendell)
Inheritance: IRequestSigner
Mostra file Open project: surgeforward/AkamaiOPEN-edgegrid-C-Sharp Class Usage Examples

Private Properties

Property Type Description
GetAuthDataValue string
GetAuthorizationHeaderValue string
GetRequestData string
GetRequestHeaders string
GetRequestStreamHash string

Public Methods

Method Description
EdgeGridV1Signer ( IList headers = null, long maxBodyHashSize = 2048 ) : System
Execute ( WebRequest request, ClientCredential credential, Stream uploadStream = null ) : Stream

Opens the connection to the {OPEN} API, assembles the signing headers and uploads any files.

Sign ( WebRequest request, ClientCredential credential, Stream uploadStream = null ) : WebRequest

Signs the given request with the given client credential.

Validate ( WebResponse response ) : void

Validates the response and attempts to detect root causes for failures for non 200 responses. The most common cause is due to time synchronization of the local server. If the local server is more than 30seconds out of sync then the API server will reject the request. TODO: catch rate limitting errors. Should delay and retry.

Private Methods

Method Description
GetAuthDataValue ( ClientCredential credential, System.DateTime timestamp ) : string
GetAuthorizationHeaderValue ( ClientCredential credential, System.DateTime timestamp, string authData, string requestData ) : string
GetRequestData ( string method, Uri uri, NameValueCollection requestHeaders = null, Stream requestStream = null ) : string
GetRequestHeaders ( NameValueCollection requestHeaders ) : string
GetRequestStreamHash ( Stream requestStream ) : string

Method Details

EdgeGridV1Signer() public method

public EdgeGridV1Signer ( IList headers = null, long maxBodyHashSize = 2048 ) : System
headers IList
maxBodyHashSize long
return System

Execute() public method

Opens the connection to the {OPEN} API, assembles the signing headers and uploads any files.
public Execute ( WebRequest request, ClientCredential credential, Stream uploadStream = null ) : Stream
request System.Net.WebRequest the
credential ClientCredential
uploadStream Stream
return Stream

Sign() public method

Signs the given request with the given client credential.
public Sign ( WebRequest request, ClientCredential credential, Stream uploadStream = null ) : WebRequest
request System.Net.WebRequest The web request to sign
credential ClientCredential the credential used in the signing
uploadStream Stream
return System.Net.WebRequest

Validate() public method

Validates the response and attempts to detect root causes for failures for non 200 responses. The most common cause is due to time synchronization of the local server. If the local server is more than 30seconds out of sync then the API server will reject the request. TODO: catch rate limitting errors. Should delay and retry.
public Validate ( WebResponse response ) : void
response System.Net.WebResponse the active response object
return void