Added servlet request back to the checksums

This commit is contained in:
Paul Trudel 2024-04-23 11:44:57 -04:00
parent de83c75716
commit 7d156e8828
3 changed files with 15 additions and 4 deletions

View File

@ -16,9 +16,12 @@ public abstract class Checksum {
protected String queryStringWithoutChecksum; protected String queryStringWithoutChecksum;
public Checksum(String apiCall, String checksum) { protected HttpServletRequest request;
public Checksum(String apiCall, String checksum, HttpServletRequest request) {
this.apiCall = ParamsUtil.sanitizeString(apiCall); this.apiCall = ParamsUtil.sanitizeString(apiCall);
this.checksum = ParamsUtil.sanitizeString(checksum); this.checksum = ParamsUtil.sanitizeString(checksum);
this.request = request;
} }
public String getApiCall() { public String getApiCall() {
@ -44,4 +47,12 @@ public abstract class Checksum {
public void setQueryStringWithoutChecksum(String queryStringWithoutChecksum) { public void setQueryStringWithoutChecksum(String queryStringWithoutChecksum) {
this.queryStringWithoutChecksum = queryStringWithoutChecksum; this.queryStringWithoutChecksum = queryStringWithoutChecksum;
} }
public void setRequest(HttpServletRequest request) {
this.request = request;
}
public HttpServletRequest getRequest() {
return request;
}
} }

View File

@ -12,8 +12,8 @@ public class GetChecksum extends Checksum {
@NotEmpty(message = "You must provide the query string") @NotEmpty(message = "You must provide the query string")
private String queryString; private String queryString;
public GetChecksum(String apiCall, String checksum, String queryString) { public GetChecksum(String apiCall, String checksum, String queryString, HttpServletRequest request) {
super(apiCall, checksum); super(apiCall, checksum, request);
this.queryString = ParamsUtil.sanitizeString(queryString); this.queryString = ParamsUtil.sanitizeString(queryString);
removeChecksumFromQueryString(); removeChecksumFromQueryString();
} }

View File

@ -119,7 +119,7 @@ public class ValidationService {
switch(apiCall.requestType) { switch(apiCall.requestType) {
case GET: case GET:
checksum = new GetChecksum(apiCall.getName(), checksumValue, queryString); checksum = new GetChecksum(apiCall.getName(), checksumValue, queryString, servletRequest);
switch(apiCall) { switch(apiCall) {
case CREATE: case CREATE:
request = new CreateMeeting(checksum, servletRequest); request = new CreateMeeting(checksum, servletRequest);