-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing signed cookie implementation
- Loading branch information
1 parent
651ac18
commit 7db461d
Showing
6 changed files
with
96 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This file should handle cookie logic for user sessions and private report authentication/access | ||
|
||
import client from "./api_service"; | ||
import { useEffect, useState } from "react"; | ||
import Cookies from 'universal-cookie'; | ||
|
||
export const CookieService = { | ||
getUserCookie() { | ||
const cookies = new Cookies(); | ||
return cookies.get('user'); | ||
}, | ||
setPrivateReportCookies(user_id, report_id, domainName, policy, signature, keyPairId) { | ||
const cookies = new Cookies(); | ||
cookies.set('CloudFront-Policy', | ||
policy, | ||
{ path: '/', | ||
domain: domainName, | ||
secure: true, | ||
httpOnly: true }); | ||
cookies.set('CloudFront-Signature', | ||
signature, | ||
{ path: '/', | ||
domain: domainName, | ||
secure: true, | ||
httpOnly: true }); | ||
cookies.set('CloudFront-Key-Pair-Id', | ||
keyPairId, | ||
{ path: '/', | ||
domain: domainName, | ||
secure: true, | ||
httpOnly: true }); | ||
|
||
return "Private Report Cookies set for user " + user_id + " and report " + report_id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters