License request/response handler.
The handler reads a license request and
parses the request. The request from the client may contain
multiple license requests. The server should iterate through the LicenseRequestMessages returned by
getRequests(). For each request either generate a license or set an error code
(see LicenseRequestMessage for details). All the licenses and errors will be sent at one time
when LicenseHandler.close() is called.
LicenseHandler handler = new LicenseHandler(config, inputStream, outputStream, licenseSvrCredential);
try {
handler.parseRequest();
List<? extends LicenseRequestMessage> requests = handler.getRequests();
for (LicenseRequestMessage licenseReq : requests) {
// If the client supports preview requests, look at licenseReq.getRequestPhase()
ContentInfo contentInfo = licenseReq.getContentInfo();
// If the content has multiple policies, determine which policy to use and call licenseReq.setPolicy()
// If the selected policy has a root license, look at licenseReq.getExistingLicenseInfo() to
// determine if a root license, leaf license, or both should be given to the user.
if (licenseReq.getRequestPhase().equals(LicenseRequestMessage.RequestPhase.Acquire) &&
desiredLicenseType.equals(License.LicenseType.Leaf)
{
// Call contentInfo.setKeyRetrievalInfo()
}
// Call licenseReq.generateLicense() to generate the appropriate license type (may be called
// more than once to generate both root and leaf)
// If desired, modify the expiration or rights in the license
}
} catch (HandlerParsingException e) {
// Use e.getErrorData() for info on the error which will be sent to the user
// Do not attempt to call any handler methods except close()
} finally {
// Always call close in a finally statement to ensure a response is sent to the client
handler.close();
}
Constructor Summary
LicenseHandler(HandlerConfiguration config,
java.io.InputStream in,
java.io.OutputStream out,
ServerCredential licenseServerCred)
Instantiates a Flash Access Handler for license requests and responses.
Instantiates a Flash Access Handler for license requests and responses.
The handler reads a batch of license requests and
sends an authentication response when the close() method is called.
The HandlerConfiguration must contain the server's credentials (used for decrypting requests and signing responses).
Parameters:
config - Contains configuration info.
in - The request body.
out - The response stream.
licenseServerCred - An Adobe-issued license server credential to be used for signing licenses.
Method Detail
getRequests
public java.util.List getRequests()
Retrieves license request data. The client may send multiple requests in a batch. The server needs to iterate
through the requests and either generate a license or set an error code. All the responses
are sent when close() is called.