-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2141 from AzureAD/msal-common-cacheType-validation
[msal-common] Add validation to cache entities
- Loading branch information
Showing
21 changed files
with
300 additions
and
46 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
change/@azure-msal-browser-2020-08-21-14-14-30-msal-common-cacheType-validation.json
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,8 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "update APP_META_DATA to APP_METADATA", | ||
"packageName": "@azure/msal-browser", | ||
"email": "sameera.gajjarapu@microsoft.com", | ||
"dependentChangeType": "patch", | ||
"date": "2020-08-21T21:13:27.893Z" | ||
} |
8 changes: 8 additions & 0 deletions
8
change/@azure-msal-common-2020-08-21-14-14-30-msal-common-cacheType-validation.json
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,8 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Adds checks for cache entities", | ||
"packageName": "@azure/msal-common", | ||
"email": "sameera.gajjarapu@microsoft.com", | ||
"dependentChangeType": "patch", | ||
"date": "2020-08-21T21:14:13.967Z" | ||
} |
8 changes: 8 additions & 0 deletions
8
change/@azure-msal-node-2020-08-21-14-14-30-msal-common-cacheType-validation.json
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,8 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "update APP_META_DATA to APP_METADATA", | ||
"packageName": "@azure/msal-node", | ||
"email": "sameera.gajjarapu@microsoft.com", | ||
"dependentChangeType": "patch", | ||
"date": "2020-08-21T21:14:30.830Z" | ||
} |
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
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
33 changes: 33 additions & 0 deletions
33
lib/msal-common/src/cache/entities/ServerTelemetryEntity.ts
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,33 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
import { SERVER_TELEM_CONSTANTS } from "../../utils/Constants"; | ||
|
||
export class ServerTelemetryEntity { | ||
failedRequests: Array<string|number>; | ||
errors: string[]; | ||
errorCount: number; | ||
cacheHits: number; | ||
|
||
/** | ||
* validates if a given cache entry is "Telemetry", parses <key,value> | ||
* @param key | ||
* @param entity | ||
*/ | ||
static isServerTelemetryEntity(key: string, entity?: object): boolean { | ||
|
||
const validateKey: boolean = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0; | ||
let validateEntity: boolean = true; | ||
|
||
if (entity) { | ||
validateEntity = | ||
entity.hasOwnProperty("failedRequests") && | ||
entity.hasOwnProperty("errors") && | ||
entity.hasOwnProperty("errorCount") && | ||
entity.hasOwnProperty("cacheHits"); | ||
} | ||
|
||
return validateKey && validateEntity; | ||
} | ||
} |
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
Oops, something went wrong.