Class AbstractUrlSigningProvider

java.lang.Object
org.opencastproject.security.urlsigning.provider.impl.AbstractUrlSigningProvider
All Implemented Interfaces:
UrlSigningProvider, org.osgi.service.cm.ManagedService
Direct Known Subclasses:
GenericUrlSigningProvider, WowzaUrlSigningProvider

public abstract class AbstractUrlSigningProvider extends Object implements UrlSigningProvider, org.osgi.service.cm.ManagedService
  • Field Details

    • KEY_PROPERTY_PREFIX

      public static final String KEY_PROPERTY_PREFIX
      The prefix for key configuration keys
      See Also:
    • SECRET

      public static final String SECRET
      The attribute name in the configuration file to define the encryption key.
      See Also:
    • URL

      public static final String URL
      The attribute name in the configuration file to define the matching url.
      See Also:
    • ORGANIZATION

      public static final String ORGANIZATION
      The attribute name in the configuration file to define the organization owning the key.
      See Also:
    • ANY_ORGANIZATION

      public static final String ANY_ORGANIZATION
      Value indicating that the key can be used by any organization
      See Also:
    • EXCLUSION_PROPERTY_KEY

      public static final String EXCLUSION_PROPERTY_KEY
      The configuration key used for the exlusion list
      See Also:
    • securityService

      protected SecurityService securityService
      The security service
    • urls

      A mapping of URL prefixes to keys used to lookup keys for a given URL.
  • Constructor Details

    • AbstractUrlSigningProvider

      public AbstractUrlSigningProvider()
  • Method Details

    • getResourceStrategy

      public abstract ResourceStrategy getResourceStrategy()
      Returns:
      The method that an implementation class will convert base urls to resource urls.
    • getLogger

      public abstract org.slf4j.Logger getLogger()
      Returns:
      The logger to use for this signing provider.
    • setSecurityService

      public void setSecurityService(SecurityService securityService)
      Parameters:
      securityService - the securityService to set
    • getUris

      public Set<String> getUris()
      Returns:
      The current set of url beginnings this signing provider is looking for.
    • getKey

      protected AbstractUrlSigningProvider.Key getKey(String baseUrl)
      GetAbstractUrlSigningProvider.Key for a given URL. This method supports multi-tenancy in means of only returning keys that can be used by the current organization. In case the current organization cannot be determined, no key will be returned.
      Parameters:
      baseUrl - The URL that needs to be signed.
      Returns:
      The AbstractUrlSigningProvider.Key if it is available.
    • updated

      public void updated(Dictionary<String,?> properties) throws org.osgi.service.cm.ConfigurationException
      Specified by:
      updated in interface org.osgi.service.cm.ManagedService
      Throws:
      org.osgi.service.cm.ConfigurationException
    • accepts

      public boolean accepts(String baseUrl)
      Description copied from interface: UrlSigningProvider
      Returns true if the implementation accepts to sign the baseUrl.
      Specified by:
      accepts in interface UrlSigningProvider
      Parameters:
      baseUrl - The base URL of the resource that needs to be signed
      Returns:
      true if the url is accepted (is valid, is not excluded and hat a key), false otherwise
    • sign

      public String sign(Policy policy) throws UrlSigningException
      Description copied from interface: UrlSigningProvider
      Creates the necessary query string to sign a resource using the given Policy
      Specified by:
      sign in interface UrlSigningProvider
      Parameters:
      policy - The Policy to sign.
      Returns:
      the policy signed
      Throws:
      UrlSigningException - Thrown if unable to sign the url.