microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileShare.java
public String generateSharedAccessSignature(
            final SharedAccessFilePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
            final SharedAccessProtocols protocols)
            throws InvalidKeyException, StorageException {

        if (!StorageCredentialsHelper.canCredentialsSignRequest(this.fileServiceClient.getCredentials())) {
            final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
            throw new IllegalArgumentException(errorMessage);
        }

        final String resourceName = this.getSharedAccessCanonicalName();

        final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
                policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, resourceName,
                ipRange, protocols, this.fileServiceClient);

        final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
                policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, "s", ipRange, protocols, signature);

        return builder.toString();
    }
public String generateSharedAccessSignature(
            final SharedAccessFilePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
            final SharedAccessProtocols protocols)
            throws InvalidKeyException, StorageException {

        if (!StorageCredentialsHelper.canCredentialsSignRequest(this.fileServiceClient.getCredentials())) {
            final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
            throw new IllegalArgumentException(errorMessage);
        }

        final String resourceName = this.getSharedAccessCanonicalName();

        final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
                policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, resourceName,
                ipRange, protocols, this.fileServiceClient);

        final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
                policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, "s", ipRange, protocols, signature);

        return builder.toString();
    }
public String generateSharedAccessSignature ( final SharedAccessFilePolicy policy , final String groupPolicyIdentifier , final IPRange ipRange , final SharedAccessProtocols protocols ) throws InvalidKeyException , StorageException { if ( ! StorageCredentialsHelper . canCredentialsSignRequest ( this . fileServiceClient . getCredentials ( ) ) ) { final String errorMessage = SR . CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY ; throw new IllegalArgumentException ( errorMessage ) ; } final String resourceName = this . getSharedAccessCanonicalName ( ) ; final String signature = SharedAccessSignatureHelper . generateSharedAccessSignatureHashForBlobAndFile ( policy , null /* SharedAccessHeaders */ , groupPolicyIdentifier , resourceName , ipRange , protocols , this . fileServiceClient ) ; final UriQueryBuilder builder = SharedAccessSignatureHelper . generateSharedAccessSignatureForBlobAndFile ( policy , null /* SharedAccessHeaders */ , groupPolicyIdentifier , "s" , ipRange , protocols , signature ) ; return builder . toString ( ) ; }
Returns a shared access signature for the share. Note this does not contain the leading "?".

@param policy
An {@link SharedAccessFilePolicy} object that represents the access policy for the
shared access signature.
@param groupPolicyIdentifier
A <code>String</code> which represents the share-level access policy.
@param ipRange
A {@link IPRange} object containing the range of allowed IP addresses.
@param protocols
A {@link SharedAccessProtocols} representing the allowed Internet protocols.

@return A <code>String</code> which represents a shared access signature for the share.

@throws StorageException
If a storage service error occurred.
@throws InvalidKeyException
If the key is invalid.
Returns a shared access signature for the share . Note this does not contain the leading ? .