1 /*
2 * Licensed to The Apereo Foundation under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional
4 * information regarding copyright ownership.
5 *
6 *
7 * The Apereo Foundation licenses this file to you under the Educational
8 * Community License, Version 2.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of the License
10 * at:
11 *
12 * http://opensource.org/licenses/ecl2.txt
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 * License for the specific language governing permissions and limitations under
18 * the License.
19 *
20 */
21 package org.opencastproject.urlsigning.common;
22
23 /**
24 * Represents a request for a streaming resource whose signed url must be validated.
25 */
26 public class ResourceRequest {
27 public enum Status {
28 BadRequest, Forbidden, Gone, Ok
29 };
30
31 /** The query string parameter key of the organization used to request resource. */
32 public static final String ENCRYPTION_ID_KEY = "keyId";
33 /** The query string key representing the conditions to allow the resource to be seen. */
34 public static final String POLICY_KEY = "policy";
35 /** The query string key representing the encrypted policy. */
36 public static final String SIGNATURE_KEY = "signature";
37
38 /** The policy encoded in Base64 from the query string value. */
39 private String encodedPolicy;
40 /** The query string value that is an id to use to retrieve the encryption key from. */
41 private String encryptionKeyId;
42 /** The policy to determine if this resource should be allowed. */
43 private Policy policy;
44 /** A textual reason for why a request was rejected. */
45 private String rejectionReason = "";
46 /** The encrypted policy used to verify this is a valid request. */
47 private String signature;
48 /** The status of whether this resource should be allowed to be shown. */
49 private Status status = Status.Forbidden;
50
51 public String getEncodedPolicy() {
52 return encodedPolicy;
53 }
54
55 public void setEncodedPolicy(String encodedPolicy) {
56 this.encodedPolicy = encodedPolicy;
57 }
58
59 public String getEncryptionKeyId() {
60 return encryptionKeyId;
61 }
62
63 public void setEncryptionKeyId(String encryptionKeyId) {
64 this.encryptionKeyId = encryptionKeyId;
65 }
66
67 public Policy getPolicy() {
68 return policy;
69 }
70
71 public void setPolicy(Policy policy) {
72 this.policy = policy;
73 }
74
75 public String getRejectionReason() {
76 return rejectionReason;
77 }
78
79 public void setRejectionReason(String rejectionReason) {
80 this.rejectionReason = rejectionReason;
81 }
82
83 public String getSignature() {
84 return signature;
85 }
86
87 public void setSignature(String signature) {
88 this.signature = signature;
89 }
90
91 public Status getStatus() {
92 return status;
93 }
94
95 public void setStatus(Status status) {
96 this.status = status;
97 }
98 }