private void SignRequest(IRequest request, RequestData requestData) { byte[] data = null; if (requestData.PostData != null) { data = requestData.PostData.WrittenBytes; if (data == null) { using (var ms = new MemoryStream()) { requestData.PostData.Write(ms, requestData.ConnectionSettings); data = ms.ToArray(); } } } ImmutableCredentials credentials; try { credentials = _credentials.GetCredentials(); } catch (Exception e) { throw new Exception("Unable to retrieve credentials required to sign the request.", e); } if (credentials == null) { throw new Exception("Unable to retrieve credentials required to sign the request."); } SignV4Util.SignRequest(request, data, credentials, _region.SystemName, "es"); }
internal static void Sign(this ICredentialsProvider credentialsProvider, IRequest request, byte[] body) { var credentials = credentialsProvider.GetCredentials(); if (credentials == null) { throw new Exception("Unable to retrieve credentials."); } var regionService = ExtractRegionAndService(request.RequestUri); SignV4Util.SignRequest(request, body, credentials, regionService.Item1, regionService.Item2); }
private void SignRequest(IRequest request, RequestData requestData) { byte[] data = null; if (requestData.PostData != null) { data = requestData.PostData.WrittenBytes; if (data == null) { using (var ms = new MemoryStream()) { requestData.PostData.Write(ms, requestData.ConnectionSettings); data = ms.ToArray(); } } } SignV4Util.SignRequest(request, data, _credentials, _region, "es"); }
protected override HttpWebRequest CreateHttpWebRequest(RequestData requestData) { if (_authType == AuthType.InstanceProfile) { RefreshCredentials(); } var request = base.CreateHttpWebRequest(requestData); byte[] data = null; if (requestData.PostData != null) { data = requestData.PostData.WrittenBytes; if (data == null) { using (var ms = new MemoryStream()) { requestData.PostData.Write(ms, requestData.ConnectionSettings); data = ms.ToArray(); } } } SignV4Util.SignRequest(request, data, _credentials, _region, "es"); return(request); }