Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chtrembl committed Feb 7, 2024
1 parent 2740f78 commit 6b5346e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public String viewcart(Model model, @RequestParam Map<String, String> params, Ht
logger.info("csrf: " + this.sessionUser.getCsrfToken());
logger.info("incoming arrAffinity: " + params.get("arrAffinity"));

if(params.get("csrf") == null || !params.get("csrf").equals(this.sessionUser.getCsrfToken()))
{
return "Invalid CSRF token";
}

this.sessionUser.getTelemetryClient().trackEvent(
String.format("PetStoreApp user %s requesting view cart", this.sessionUser.getName()),
this.sessionUser.getCustomEventProperties(), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public DPResponse viewCart(AzurePetStoreSessionInfo azurePetStoreSessionInfo) {
Response response = null;
try {
Request request = new Request.Builder()
.url(this.VIEW_CART_URL)
.url(this.VIEW_CART_URL + "?csrf=" + azurePetStoreSessionInfo.getCsrfToken())
.method("GET", null)
.addHeader("Cookie", "JSESSIONID=" + azurePetStoreSessionInfo.getSessionID())
.addHeader("Cookie", "JSESSIONID=" + azurePetStoreSessionInfo.getSessionID()+"; ARRAffinity="+azurePetStoreSessionInfo.getArrAffinity())
.addHeader("Content-Type", "text/html")
.build();

Expand Down

0 comments on commit 6b5346e

Please sign in to comment.