public static void signTableRequest ( final StorageCredentials creds , final java . net . HttpURLConnection request , final long contentLength , OperationContext opContext ) throws InvalidKeyException , StorageException { if ( creds . getClass ( ) . equals ( StorageCredentialsAccountAndKey . class ) ) { opContext = opContext == null ? new OperationContext ( ) : opContext ; request . setRequestProperty ( Constants . HeaderConstants . DATE , Utility . getGMTTime ( ) ) ; final Canonicalizer canonicalizer = CanonicalizerFactory . getTableCanonicalizer ( request ) ; final String stringToSign = canonicalizer . canonicalize ( request , creds . getAccountName ( ) , contentLength ) ; final String computedBase64Signature = StorageCredentialsHelper . computeHmac256 ( creds , stringToSign ) ; Logger . debug ( opContext , LogConstants . SIGNING , stringToSign ) ; request . setRequestProperty ( Constants . HeaderConstants . AUTHORIZATION , String . format ( "%s %s:%s" , "SharedKey" , creds . getAccountName ( ) , computedBase64Signature ) ) ; } }
Signs a request using the specified operation context under the Shared Key authentication scheme .