Class AuthAzureSAS
- All Implemented Interfaces:
AutoCloseable
Create Azure Shared Access Signature tokens for signed Azure Storage requests.
Chilkat.AuthAzureSAS creates Azure Shared Access Signature
authentication tokens. It defines the SAS string-to-sign, supplies the Azure
Storage account access key used to compute the signature, and controls which
parameters are included in the generated SAS token query string. The
resulting token can be used with Chilkat.Rest,
Chilkat.Http, or other request-building code that needs
time-limited, permission-scoped access to Azure Storage resources.
SAS token generation
Generate a signed query-string token that authorizes limited access to an Azure Storage resource.
String-to-sign control
Provide the exact Azure SAS string-to-sign required for the storage service and resource being accessed.
Account key signing
Use the Azure Storage account access key to compute the signature placed in the generated SAS token.
Token parameters
Add signed SAS parameters such as permissions, expiry, resource type, API version, protocol, or IP restrictions.
Non-token parameters
Add query parameters that should accompany the request but should not be included as part of the SAS token itself.
REST integration
Use the generated SAS query string with Azure Storage requests built
using Chilkat.Rest or other Chilkat HTTP workflows.
Common pattern:
Create an AuthAzureSAS object, set the Azure Storage
AccessKey, provide the required StringToSign, add
SAS token parameters with SetTokenParam, add any extra query
parameters with SetNonTokenParam, then call
GenerateToken. Use AuthAzureSAS when you need a SAS
query token; use Chilkat.AuthAzureStorage when you need Shared
Key authorization headers instead.
For an extended overview, see AuthAzureSAS Class Overview.
</section>
Instances hold a native Chilkat object: close them with ChilkatObject.close() (try-with-resources) when
done; an unclosed instance is freed when it becomes unreachable.
- See Also:
- Online reference
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all params set by the methods SetNonTokenParam and SetTokenParam.Generates and returns the SAS token based on the definedand params.getStringToSign()This is the signing key (access key) that must be kept private.Defines the format of the string to sign.voidsetAccessKey(String value)Sets theAccessKeyproperty; seegetAccessKey().voidsetNonTokenParam(String name, String value)Adds a non-token parameter name/value.voidsetStringToSign(String value)Sets theStringToSignproperty; seegetStringToSign().voidsetTokenParam(String name, String authParamName, String value)Adds a token parameter name/value.Methods inherited from class com.chilkatsoft.chilkat2.ChilkatObject
close, getDebugLogFilePath, getLastErrorHtml, getLastErrorText, getLastErrorXml, getLastMethodSuccess, getVerboseLogging, getVersion, isClosed, setDebugLogFilePath, setLastMethodSuccess, setVerboseLogging, toString
-
Constructor Details
-
AuthAzureSAS
public AuthAzureSAS()Creates a newAuthAzureSASobject.
-
-
Method Details
-
getAccessKey
This is the signing key (access key) that must be kept private. It is a base64 string such asabdTvCZFFoWUyre6erlNN+IOb9qhXgDsyhrxmZvpmxqFDwpl9oD0X9Fy0hIQa6L5UohznRLmkCtUYySO4Y2eaw==- Returns:
- the value of the
AccessKeyproperty
-
setAccessKey
Sets theAccessKeyproperty; seegetAccessKey().- Parameters:
value- the new value (notnull)
-
getStringToSign
Defines the format of the string to sign.The format is specified as a comma-separated list of names. For example:
signedpermissions,signedstart,signedexpiry,canonicalizedresource,signedidentifier,signedIP,signedProtocol,signedversion,rscc,rscd,rsce,rscl,rsct
This will result in an actual string-to-sign that is composed of the values for each name separated by newline (LF) chars. For example:
signedpermissions + \n + signedstart + \n + signedexpiry + \n + canonicalizedresource + \n + signedidentifier + \n + signedIP + \n + signedProtocol + \n + signedversion + \n + rscc + \n + rscd + \n + rsce + \n + rscl + \n + rsct
- Returns:
- the value of the
StringToSignproperty
-
setStringToSign
Sets theStringToSignproperty; seegetStringToSign().- Parameters:
value- the new value (notnull)
-
clear
public void clear()Clears all params set by the methods SetNonTokenParam and SetTokenParam. -
generateToken
Generates and returns the SAS token based on the definedand params.getStringToSign()- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setNonTokenParam
Adds a non-token parameter name/value. This is a value that is included in the string to sign, but is NOT included in the token query params.- Parameters:
name- thenameargument (notnull)value- thevalueargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setTokenParam
Adds a token parameter name/value. This is a value that is included in the string to sign, and is also included in the token query params.- Parameters:
name- thenameargument (notnull)authParamName- theauthParamNameargument (notnull)value- thevalueargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-