org.soyatec.windowsazure.authenticate
Class SharedKeyCredentials

java.lang.Object
  extended by org.soyatec.windowsazure.authenticate.SharedKeyCredentials
Direct Known Subclasses:
SharedAccessSignatureCredentials, SharedKeyCredentialsWrapper

public class SharedKeyCredentials
extends java.lang.Object

Objects of this class contain the credentials (name and key) of a storage account. http://msdn.microsoft.com/en-us/library/dd179428.aspx All authenticated requests must include the Coordinated Universal Time (UTC) timestamp for the request. You can specify the timestamp either in the x-ms-date header, or in the standard HTTP/HTTPS Date header. If both headers are specified on the request, the value of x-ms-date is used as the request's time of creation. The storage services ensure that a request is no older than 15 minutes by the time it reaches the service. This guards against certain security attacks, including replay attacks. When this check fails, the server returns response code 403 (Forbidden).


Constructor Summary
SharedKeyCredentials(java.lang.String accountName, byte[] key)
          Create a SharedKeyCredentials object given an account name and a shared key.
 
Method Summary
 java.lang.String getAccountName()
           
 byte[] getKey()
           
 void signRequest(org.apache.http.HttpRequest request, org.soyatec.windowsazure.internal.ResourceUriComponents uriComponents)
          Signs the request appropriately to make it an authenticated request.
 void signRequestForSharedKeyLite(org.apache.http.HttpRequest request, org.soyatec.windowsazure.internal.ResourceUriComponents uriComponents)
          Signs requests using the SharedKeyLite authentication scheme with is used for the table storage service.
 java.lang.String signSharedAccessUrl(java.lang.String permissions, java.lang.String start, java.lang.String expiry, java.lang.String canonicalizedResource, java.lang.String identifier)
          Create the signature with permissions, start, expiry, canonicalizedResource and identifier.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedKeyCredentials

public SharedKeyCredentials(java.lang.String accountName,
                            byte[] key)
Create a SharedKeyCredentials object given an account name and a shared key.

Parameters:
accountName -
key -
Method Detail

signRequest

public void signRequest(org.apache.http.HttpRequest request,
                        org.soyatec.windowsazure.internal.ResourceUriComponents uriComponents)
Signs the request appropriately to make it an authenticated request. Note that this method takes the URI components as decoding the URI components requires the knowledge of whether the URI is in path-style or host-style and a host-suffix if it's host-style.

Parameters:
request -
uriComponents -

signRequestForSharedKeyLite

public void signRequestForSharedKeyLite(org.apache.http.HttpRequest request,
                                        org.soyatec.windowsazure.internal.ResourceUriComponents uriComponents)
Signs requests using the SharedKeyLite authentication scheme with is used for the table storage service.

Parameters:
request -
uriComponents -

signSharedAccessUrl

public java.lang.String signSharedAccessUrl(java.lang.String permissions,
                                            java.lang.String start,
                                            java.lang.String expiry,
                                            java.lang.String canonicalizedResource,
                                            java.lang.String identifier)
Create the signature with permissions, start, expiry, canonicalizedResource and identifier.

Parameters:
permissions -
start -
expiry -
canonicalizedResource -
identifier -
Returns:
signSharedAccessUrl

getAccountName

public java.lang.String getAccountName()
Returns:
the account name

getKey

public byte[] getKey()
Returns:
key