Class Policy
java.lang.Object
org.opencastproject.urlsigning.common.Policy
Represents a policy for a signed resource that looks like
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.base.Optional<InetAddress> com.google.common.base.Optional<org.joda.time.DateTime> org.joda.time.DateTimestatic PolicymkPolicyValidFrom(String baseUrl, org.joda.time.DateTime validUntil, org.joda.time.DateTime validFrom) Create aPolicywith a date and time the resource will become available.static PolicymkPolicyValidFromWithIP(String baseUrl, org.joda.time.DateTime validUntil, org.joda.time.DateTime validFrom, String ipAddress) Create aPolicywith both a date and time the resource will become available and a client ip address to restrict it to.static PolicymkPolicyValidWithIP(String baseUrl, org.joda.time.DateTime validUntil, String ipAddress) Create aPolicywith the only ip address that will be allowed to view the resource.static PolicymkSimplePolicy(String baseUrl, org.joda.time.DateTime validUntil) Create aPolicywith only the required properties.voidsetResourceStrategy(ResourceStrategy resourceStrategy) Set a newResourceStrategyto transform the base url to a resource url.
-
Method Details
-
mkSimplePolicy
Create aPolicywith only the required properties.- Parameters:
baseUrl- The url to the resource that will be signed.validUntil- The date and time the resource will be available until- Returns:
- A new
Policywith the parameters set.
-
mkPolicyValidFrom
public static Policy mkPolicyValidFrom(String baseUrl, org.joda.time.DateTime validUntil, org.joda.time.DateTime validFrom) Create aPolicywith a date and time the resource will become available.- Parameters:
baseUrl- The url to the resource being signed.validUntil- The date and time the resource is available until.validFrom- The date and time the resource will become available.- Returns:
- A new
Policyfor limiting access to the resource.
-
mkPolicyValidWithIP
public static Policy mkPolicyValidWithIP(String baseUrl, org.joda.time.DateTime validUntil, String ipAddress) Create aPolicywith the only ip address that will be allowed to view the resource.- Parameters:
baseUrl- The url to the resource being signed.validUntil- The date the resource will be available until.ipAddress- The ip of the client that will be allowed to view the resource.- Returns:
- A new
Policyfor limiting access to the resource.
-
mkPolicyValidFromWithIP
public static Policy mkPolicyValidFromWithIP(String baseUrl, org.joda.time.DateTime validUntil, org.joda.time.DateTime validFrom, String ipAddress) Create aPolicywith both a date and time the resource will become available and a client ip address to restrict it to.- Parameters:
baseUrl- The url to the resource that is being signed.validUntil- The date and time the resource will be available until.validFrom- The date and time the resource will become available.ipAddress- The ip of the client that will be allowed to view the resource.- Returns:
- A new
Policyfor limiting access to the resource.
-
getBaseUrl
- Returns:
- Get the url to the resource that is being signed with this policy.
-
getValidUntil
public org.joda.time.DateTime getValidUntil()- Returns:
- Get the date this resource is valid until.
-
getResource
- Returns:
- Get the url for the resource in this
Policy.
-
setResourceStrategy
Set a newResourceStrategyto transform the base url to a resource url.- Parameters:
resourceStrategy- The resource strategy to apply to transform the base url.
-
getClientIpAddress
- Returns:
- Get the optional ip address of the client that this resource will be restricted to.
-
getValidFrom
public com.google.common.base.Optional<org.joda.time.DateTime> getValidFrom()- Returns:
- Get the optional date and time this resource will become available.
-