Class NetStorageCmsSigner

java.lang.Object
org.frankframework.extensions.akamai.NetStorageCmsSigner

public class NetStorageCmsSigner extends Object
The NetStorageCMSv35Signer is responsible for brokering the communication between the software layer and the API. This includes the signing and formatting the request appropriately so that the implementation detail is abstracted from calling libraries. The intended calling library is the NetStorage class, but this layer can be called directly and is offered as a convenience interface for enhanced implementations.
Author:
Niels Meijer
  • Field Details

  • Constructor Details

    • NetStorageCmsSigner

      public NetStorageCmsSigner(URI uri, String nonce, String accessToken)
      Primary invocation for an API communication. This constructor is used for convenience when not uploading content
      Parameters:
      uri - the url to interact with (eg: http://example.akamaihd.net/254462 )
      nonce - provisioned nonce from the Luna portal
      accessToken - the associated accessToken generated by the portal
    • NetStorageCmsSigner

      public NetStorageCmsSigner(URI uri, String nonce, String accessToken, NetStorageCmsSigner.SignType signType)
      Primary invocation for an API communication. This constructor is used for convenience when not uploading content
      Parameters:
      uri - the url to interact with (eg: http://example.akamaihd.net/254462 )
      nonce - provisioned nonce from the Luna portal
      accessToken - the associated accessToken generated by the portal
      signType - the base64 encoded signature algorithm
    • NetStorageCmsSigner

      public NetStorageCmsSigner(URI uri, CredentialFactory accessTokenCf, NetStorageCmsSigner.SignType signType)
  • Method Details

    • getActionHeaderValue

      protected String getActionHeaderValue(NetStorageRequest action)
      Computes the value for the the X-Akamai-ACS-Action: header. This is an url query-string encoded separated list of parameters in the form of name=value&name2=value2.
      Parameters:
      action - the set of action parameters to be sent in the API request
      Returns:
      an url encoded query string of name-value pairs from the NetStorageRequest
    • getAuthDataHeaderValue

      protected String getAuthDataHeaderValue()
      Constructs the X-Akamai-ACS-Auth-Data header which contains the signing version, the current time, a random number and the nonce that is used to sign the data.
      Returns:
      the data field in a comma separated list
    • getAuthSignHeaderValue

      protected String getAuthSignHeaderValue(String action, String authData)
      Computes the X-Akamai-ACS-Auth-Sign header for a given Action and Data header values. This results in a base64 encoded representation of the hash as required by the spec. The api server will compute this same hash to validate the request
      Parameters:
      action - action header values getActionHeaderValue(NetStorageRequest)
      authData - data header values getAuthDataHeaderValue()
      Returns:
      a base64 encoded return string
    • computeHeaders

      public Map<String,String> computeHeaders(NetStorageRequest netStorageAction)
      Assembles the HTTP Headers necessary for API communication
      Parameters:
      netStorageAction - the set of action parameters to be sent in the API request
      Returns:
      Map of name-value pairs representing HTTP Headers and values.