Class UrlSigningServiceOsgiUtil

java.lang.Object
org.opencastproject.security.urlsigning.utils.UrlSigningServiceOsgiUtil

public final class UrlSigningServiceOsgiUtil extends Object
  • Field Details

    • URL_SIGNING_EXPIRES_DURATION_SECONDS_KEY

      public static final String URL_SIGNING_EXPIRES_DURATION_SECONDS_KEY
      The default key in the OSGI service configuration for when signed URLs will expire.
      See Also:
    • URL_SIGNING_USE_CLIENT_IP

      public static final String URL_SIGNING_USE_CLIENT_IP
      The default key in the OSGI service configuration for whether to use client IP in the signature.
      See Also:
    • DEFAULT_URL_SIGNING_EXPIRE_DURATION

      public static final long DEFAULT_URL_SIGNING_EXPIRE_DURATION
      The default time before a piece of signed content expires. 2 Hours.
      See Also:
    • DEFAULT_SIGN_WITH_CLIENT_IP

      public static final Boolean DEFAULT_SIGN_WITH_CLIENT_IP
      The default for whether to use the client IP in the signature.
  • Method Details

    • getUpdatedSigningExpiration

      public static long getUpdatedSigningExpiration(Dictionary properties, String className)
      Get the amount of seconds before a signed URL should expire from a Dictionary. Uses the UrlSigningServiceOsgiUtil's default value and default key name.
      Parameters:
      properties - The Dictionary to look through to get the expire duration.
      className - The name of the class that is getting the expire duration for logging.
      Returns:
      The duration that URLs expire from the properties if present, the default if it isn't.
    • getUpdatedSigningExpiration

      public static long getUpdatedSigningExpiration(Dictionary properties, String className, String key, long defaultExpiry)
      Get the amount of seconds before a signed URL should expire from a Dictionary.
      Parameters:
      properties - The Dictionary to look through to get the expire duration.
      className - The name of the class that is getting the expire duration for logging.
      key - The key in the dictionary that should contain the expire duration.
      defaultExpiry - The expire duration to use if one is not found in the Dictionary
      Returns:
      The duration that URLs expire from the properties if present, the default if it isn't.
    • getUpdatedSignWithClientIP

      public static boolean getUpdatedSignWithClientIP(Dictionary properties, String className)
      Get whether a signed URL should contain the client's IP from a Dictionary. Uses the UrlSigningServiceOsgiUtil's default value and default key name.
      Parameters:
      properties - The Dictionary to look through for whether the IP should be included.
      className - The name of the class that is getting the value for logging.
      Returns:
      Whether the URLs that are signed should contain the client's IP address
    • getUpdatedSignWithClientIP

      public static boolean getUpdatedSignWithClientIP(Dictionary properties, String className, String key, boolean defaultSignWithIP)
      Get whether a signed URL should contain the client's IP from a Dictionary.
      Parameters:
      properties - The Dictionary to look through for whether the IP should be included.
      className - The name of the class that is getting the value for logging.
      key - The key in the dictionary that should contain the value.
      defaultSignWithIP - The default to use if the value is not found in the Dictionary
      Returns:
      true if signed URLs should contain the client IP, false if not.