mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
**Related issue:** Resolves #14401 # Checklist for submitter this updates the mechanism of storing the auth token for a user that is used for making requests and validating a user session. We change the storage from local storage to a cookie. This allow a bit more security and prepares for a future change where we will allow the browser to handle setting and passing the auth token in the request. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. - [x] QA'd all new/changed functionality manually
20 lines
478 B
TypeScript
20 lines
478 B
TypeScript
const {
|
|
window: { localStorage },
|
|
} = global;
|
|
|
|
const local = {
|
|
clear: (): void => {
|
|
localStorage.clear();
|
|
},
|
|
getItem: (itemName: string): string | null => {
|
|
return localStorage.getItem(`FLEET::${itemName}`);
|
|
},
|
|
setItem: (itemName: string, value: string): void => {
|
|
return localStorage.setItem(`FLEET::${itemName}`, value);
|
|
},
|
|
removeItem: (itemName: string): void => {
|
|
localStorage.removeItem(`FLEET::${itemName}`);
|
|
},
|
|
};
|
|
|
|
export default local;
|