Permalink
Cannot retrieve contributors at this time
19 lines (19 sloc)
881 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@azure/core-auth/dist-esm/src/tokenCredential.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
// Copyright (c) Microsoft Corporation. | |
// Licensed under the MIT license. | |
/** | |
* Tests an object to determine whether it implements TokenCredential. | |
* | |
* @param credential - The assumed TokenCredential to be tested. | |
*/ | |
export function isTokenCredential(credential) { | |
// Check for an object with a 'getToken' function and possibly with | |
// a 'signRequest' function. We do this check to make sure that | |
// a ServiceClientCredentials implementor (like TokenClientCredentials | |
// in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if | |
// it doesn't actually implement TokenCredential also. | |
const castCredential = credential; | |
return (castCredential && | |
typeof castCredential.getToken === "function" && | |
(castCredential.signRequest === undefined || castCredential.getToken.length > 0)); | |
} | |
//# sourceMappingURL=tokenCredential.js.map |