@azure/msal-node
Advanced tools
Comparing version 1.0.0-alpha.0 to 1.0.0-alpha.2
@@ -0,1 +1,10 @@ | ||
# 1.0.0-alpha.2 | ||
- Fix an issue where the `dist` folder was not published (#2013) | ||
# 1.0.0-alpha.1 | ||
- Add `response` to device code in `msal-node` (#1947) | ||
- `msal-node` docs update (#1948) | ||
- Export `AccountInfo` in `msal-node (#2005) | ||
# 1.0.0-alpha.0 | ||
@@ -26,3 +35,2 @@ | ||
- SilentFlow node interface (#1809) | ||
- Extensions (#1830, #1831, #1832, #1833, #1835, #1849) | ||
- Update TokenCache name (#1901) |
@@ -1,2 +0,2 @@ | ||
import { DeviceCodeRequest } from '@azure/msal-common'; | ||
import { DeviceCodeRequest, AuthenticationResult } from '@azure/msal-common'; | ||
import { Configuration } from '../config/Configuration'; | ||
@@ -36,3 +36,3 @@ import { ClientApplication } from './ClientApplication'; | ||
*/ | ||
acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<string>; | ||
acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult>; | ||
} |
@@ -8,2 +8,2 @@ export { PublicClientApplication } from './client/PublicClientApplication'; | ||
export { CryptoProvider } from './crypto/CryptoProvider'; | ||
export { AuthorizationCodeRequest, DeviceCodeRequest, RefreshTokenRequest, PromptValue, ResponseMode, AuthenticationResult, AuthError, AuthErrorMessage, INetworkModule, LogLevel, } from '@azure/msal-common'; | ||
export { AuthorizationCodeRequest, DeviceCodeRequest, RefreshTokenRequest, PromptValue, ResponseMode, AuthenticationResult, AccountInfo, AuthError, AuthErrorMessage, INetworkModule, LogLevel, } from '@azure/msal-common'; |
@@ -1136,3 +1136,3 @@ 'use strict'; | ||
var version = "1.0.0-alpha.0"; | ||
var version = "1.0.0-alpha.2"; | ||
@@ -1139,0 +1139,0 @@ var defaultSerializedCache = { |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=require("@azure/msal-common"),n=e(require("axios")),o=e(require("debug")),i=require("uuid"),a=e(require("crypto"));function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator"))),function(e){e.GET="get",e.POST="post"}(t||(t={}));var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=function(){function e(){n.defaults.validateStatus=function(){return!0}}var r=e.prototype;return r.sendGetRequestAsync=function(e,r){try{return Promise.resolve(n({method:t.GET,url:e,headers:r&&r.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},r.sendPostRequestAsync=function(e,r){try{return Promise.resolve(n({method:t.POST,url:e,data:r&&r.body||"",headers:r&&r.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},e}(),h={clientId:"",authority:"",knownAuthorities:[],cloudDiscoveryMetadata:""},d={},g={loggerOptions:{loggerCallback:function(e,t,n){o("msal:"+r.LogLevel[e]+(n?"-Pii":""))(t)},piiLoggingEnabled:!1,logLevel:r.LogLevel.Info},networkClient:function(){function e(){}return e.getNetworkClient=function(){return new l},e}().getNetworkClient()};function f(e){var t=e.cache,r=e.system;return{auth:s({},h,{},e.auth),cache:s({},d,{},t),system:s({},g,{},r)}}var p=function(){function e(){}return e.generateGuid=function(){return i.v4()},e.isGuid=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e}(),y=function(){function e(){}return e.base64Encode=function(e){return Buffer.from(e,"utf8").toString("base64")},e.base64EncodeUrl=function(t){return e.base64Encode(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.base64Decode=function(e){return Buffer.from(e,"base64").toString("utf8")},e.base64DecodeUrl=function(t){for(var r=t.replace(/-/g,"+").replace(/_/g,"/");r.length%4;)r+="=";return e.base64Decode(r)},e}(),m=function(){function e(){}var t=e.prototype;return t.generatePkceCodes=function(){try{var e=this.generateCodeVerifier(),t=this.generateCodeChallengeFromVerifier(e);return Promise.resolve({verifier:e,challenge:t})}catch(e){return Promise.reject(e)}},t.generateCodeVerifier=function(){var e=a.randomBytes(32),t=this.bufferToCVString(e);return y.base64EncodeUrl(t)},t.generateCodeChallengeFromVerifier=function(e){return y.base64EncodeUrl(this.sha256(e).toString("ascii"))},t.sha256=function(e){return a.createHash("sha256").update(e).digest()},t.bufferToCVString=function(e){for(var t=[],r=0;r<e.byteLength;r+=1)t.push(u[e[r]%u.length]);return t.join("")},e}(),v=function(){function e(){this.pkceGenerator=new m}var t=e.prototype;return t.createNewGuid=function(){return p.generateGuid()},t.base64Encode=function(e){return y.base64Encode(e)},t.base64Decode=function(e){return y.base64Decode(e)},t.generatePkceCodes=function(){return this.pkceGenerator.generatePkceCodes()},e}(),C=function(){function e(){}return e.deserializeJSONBlob=function(e){return r.StringUtils.isEmpty(e)?{}:JSON.parse(e)},e.deserializeAccounts=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,realm:o.realm,localAccountId:o.local_account_id,username:o.username,authorityType:o.authority_type,name:o.name,clientInfo:o.client_info,lastModificationTime:o.last_modification_time,lastModificationApp:o.last_modification_app},a=new r.AccountEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeIdTokens=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,credentialType:o.credential_type,clientId:o.client_id,secret:o.secret,realm:o.realm},a=new r.IdTokenEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeAccessTokens=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,credentialType:o.credential_type,clientId:o.client_id,secret:o.secret,realm:o.realm,target:o.target,cachedAt:o.cached_at,expiresOn:o.expires_on,extendedExpiresOn:o.extended_expires_on,refreshOn:o.refresh_on,keyId:o.key_id,tokenType:o.token_type},a=new r.AccessTokenEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeRefreshTokens=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,credentialType:o.credential_type,clientId:o.client_id,secret:o.secret,familyId:o.family_id,target:o.target,realm:o.realm},a=new r.RefreshTokenEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeAppMetadata=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={clientId:o.client_id,environment:o.environment,familyId:o.family_id},a=new r.AppMetadataEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeAllCache=function(e){return{accounts:e.Account?this.deserializeAccounts(e.Account):{},idTokens:e.IdToken?this.deserializeIdTokens(e.IdToken):{},accessTokens:e.AccessToken?this.deserializeAccessTokens(e.AccessToken):{},refreshTokens:e.RefreshToken?this.deserializeRefreshTokens(e.RefreshToken):{},appMetadata:e.AppMetadata?this.deserializeAppMetadata(e.AppMetadata):{}}},e}(),T=function(){function e(){}return e.serializeJSONBlob=function(e){return JSON.stringify(e)},e.serializeAccounts=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,realm:n.realm,local_account_id:n.localAccountId,username:n.username,authority_type:n.authorityType,name:n.name,client_info:n.clientInfo,last_modification_time:n.lastModificationTime,last_modification_app:n.lastModificationApp}})),t},e.serializeIdTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm}})),t},e.serializeAccessTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm,target:n.target,cached_at:n.cachedAt,expires_on:n.expiresOn,extended_expires_on:n.extendedExpiresOn,refresh_on:n.refreshOn,key_id:n.keyId,token_type:n.tokenType}})),t},e.serializeRefreshTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,family_id:n.familyId,target:n.target,realm:n.realm}})),t},e.serializeAppMetadata=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={client_id:n.clientId,environment:n.environment,family_id:n.familyId}})),t},e.serializeAllCache=function(e){return{Account:this.serializeAccounts(e.accounts),IdToken:this.serializeIdTokens(e.idTokens),AccessToken:this.serializeAccessTokens(e.accessTokens),RefreshToken:this.serializeRefreshTokens(e.refreshTokens),AppMetadata:this.serializeAppMetadata(e.appMetadata)}},e}(),b=function(e){function t(t){var r;return(r=e.call(this)||this).inMemoryCache={accounts:{},accessTokens:{},refreshTokens:{},appMetadata:{},idTokens:{}},r.changeEmitters=[],r.logger=t,r}c(t,e);var n=t.prototype;return n.registerChangeEmitter=function(e){this.changeEmitters.push(e)},n.emitChange=function(){this.changeEmitters.forEach((function(e){return e.call(null)}))},n.getCache=function(){return this.logger.verbose("Getting in-memory cache"),this.inMemoryCache},n.setCache=function(e){this.logger.verbose("Setting in-memory cache"),this.inMemoryCache=e,this.emitChange()},n.setItem=function(e,t,n){this.logger.verbose("setItem called for item type: "+n),this.logger.verbosePii("Item key: "+e);var o=this.getCache();switch(n){case r.CacheSchemaType.ACCOUNT:o.accounts[e]=t;break;case r.CacheSchemaType.CREDENTIAL:switch(r.CredentialEntity.getCredentialType(e)){case r.CredentialType.ID_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ID_TOKEN),o.idTokens[e]=t;break;case r.CredentialType.ACCESS_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ACCESS_TOKEN),o.accessTokens[e]=t;break;case r.CredentialType.REFRESH_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.REFRESH_TOKEN),o.refreshTokens[e]=t}break;case r.CacheSchemaType.APP_META_DATA:o.appMetadata[e]=t;break;default:throw r.ClientAuthError.createInvalidCacheTypeError()}this.setCache(o),this.emitChange()},n.getItem=function(e,t){this.logger.verbose("getItem called for item type: "+t),this.logger.verbosePii("Item key: "+e);var n=this.getCache();switch(t){case r.CacheSchemaType.ACCOUNT:return n.accounts[e]||null;case r.CacheSchemaType.CREDENTIAL:var o=null;switch(r.CredentialEntity.getCredentialType(e)){case r.CredentialType.ID_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ID_TOKEN),o=n.idTokens[e]||null;break;case r.CredentialType.ACCESS_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ACCESS_TOKEN),o=n.accessTokens[e]||null;break;case r.CredentialType.REFRESH_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.REFRESH_TOKEN),o=n.refreshTokens[e]||null}return o;case r.CacheSchemaType.APP_META_DATA:return n.appMetadata[e]||null;default:throw r.ClientAuthError.createInvalidCacheTypeError()}},n.removeItem=function(e,t){this.logger.verbose("removeItem called for item type: "+t),this.logger.verbosePii("Item key: "+e);var n=this.getCache(),o=!1;switch(t){case r.CacheSchemaType.ACCOUNT:n.accounts[e]&&(delete n.accounts[e],o=!0);break;case r.CacheSchemaType.CREDENTIAL:switch(r.CredentialEntity.getCredentialType(e)){case r.CredentialType.ID_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ID_TOKEN),n.idTokens[e]&&(delete n.idTokens[e],o=!0);break;case r.CredentialType.ACCESS_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ACCESS_TOKEN),n.accessTokens[e]&&(delete n.accessTokens[e],o=!0);break;case r.CredentialType.REFRESH_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.REFRESH_TOKEN),n.refreshTokens[e]&&(delete n.refreshTokens[e],o=!0)}break;case r.CacheSchemaType.APP_META_DATA:n.appMetadata[e]&&(delete n.appMetadata[e],o=!0);break;default:throw r.ClientAuthError.createInvalidCacheTypeError()}return o&&(this.setCache(n),this.emitChange()),o},n.containsKey=function(e){return!!e},n.getKeys=function(){this.logger.verbose("Retrieving all cache keys");var e=this.getCache();return[].concat(Object.keys(e.accounts),Object.keys(e.idTokens),Object.keys(e.accessTokens),Object.keys(e.refreshTokens),Object.keys(e.appMetadata))},n.clear=function(){var e=this;this.logger.verbose("Clearing cache entries created by MSAL"),this.getKeys().forEach((function(t){e.removeItem(t)})),this.emitChange()},t.generateInMemoryCache=function(e){return C.deserializeAllCache(C.deserializeJSONBlob(e))},t.generateJsonCache=function(e){return T.serializeAllCache(e)},t}(r.CacheManager),k={},A={},E={},_={},O={},S=function(){function e(e,t,r){this.hasChanged=!1,this.storage=e,this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this)),r&&(this.persistence=r),this.logger=t}var t=e.prototype;return t.cacheHasChanged=function(){return this.hasChanged},t.serialize=function(){this.logger.verbose("Serializing in-memory cache");var e=T.serializeAllCache(this.storage.getCache());return r.StringUtils.isEmpty(this.cacheSnapshot)?this.logger.verbose("No cache snapshot to merge"):(this.logger.verbose("Reading cache snapshot from disk"),e=this.mergeState(JSON.parse(this.cacheSnapshot),e)),this.hasChanged=!1,JSON.stringify(e)},t.deserialize=function(e){if(this.logger.verbose("Deserializing JSON to in-memory cache"),this.cacheSnapshot=e,r.StringUtils.isEmpty(this.cacheSnapshot))this.logger.verbose("No cache snapshot to deserialize");else{this.logger.verbose("Reading cache snapshot from disk");var t=C.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));this.storage.setCache(t)}},t.writeToPersistence=function(){try{var e=this;return e.logger.verbose("Writing to persistent cache"),Promise.resolve(function(){if(e.persistence){e.logger.verbose("cachePlugin (persistent cache) not set by the user");var t=T.serializeAllCache(e.storage.getCache());return Promise.resolve(e.persistence.writeToStorage((function(n){return r.StringUtils.isEmpty(n)?e.logger.verbose("No state from disk"):(e.logger.verbose("Reading state from disk"),e.cacheSnapshot=n,t=e.mergeState(JSON.parse(n),t)),JSON.stringify(t)}))).then((function(){e.hasChanged=!1}))}throw r.ClientAuthError.createCachePluginError()}())}catch(e){return Promise.reject(e)}},t.readFromPersistence=function(){try{var e=this;return e.logger.verbose("Reading from persistent cache"),Promise.resolve(function(){if(e.persistence)return e.logger.verbose("cachePlugin (persistent cache) not set by the user"),Promise.resolve(e.persistence.readFromStorage()).then((function(t){if(e.cacheSnapshot=t,r.StringUtils.isEmpty(e.cacheSnapshot))e.logger.verbose("No cache snapshot to overlay and deserialize");else{e.logger.verbose("Reading cache snapshot from disk");var n=e.overlayDefaults(JSON.parse(e.cacheSnapshot));e.logger.verbose("Deserializing JSON");var o=C.deserializeAllCache(n);e.storage.setCache(o)}}));throw r.ClientAuthError.createCachePluginError()}())}catch(e){return Promise.reject(e)}},t.getAllAccounts=function(){return this.logger.verbose("getAllAccounts called"),this.storage.getAllAccounts()},t.removeAccount=function(e){this.logger.verbose("removeAccount called"),this.storage.removeAccount(r.AccountEntity.generateAccountCacheKey(e))},t.handleChangeEvent=function(){this.hasChanged=!0},t.mergeState=function(e,t){this.logger.verbose("Merging in-memory cache with cache snapshot");var r=this.mergeRemovals(e,t);return this.mergeUpdates(r,t)},t.mergeUpdates=function(e,t){var r=this;return Object.keys(t).forEach((function(n){var o=t[n];if(e.hasOwnProperty(n)){var i=null!==o,a="object"==typeof o,s=!Array.isArray(o);i&&a&&s?r.mergeUpdates(e[n],o):e[n]=o}else null!==o&&(e[n]=o)})),e},t.mergeRemovals=function(e,t){return this.logger.verbose("Remove updated entries in cache"),s({Account:null!=e.Account?this.mergeRemovalsDict(e.Account,t.Account):e.Account,AccessToken:null!=e.AccessToken?this.mergeRemovalsDict(e.AccessToken,t.AccessToken):e.AccessToken,RefreshToken:null!=e.RefreshToken?this.mergeRemovalsDict(e.RefreshToken,t.RefreshToken):e.RefreshToken,IdToken:null!=e.IdToken?this.mergeRemovalsDict(e.IdToken,t.IdToken):e.IdToken,AppMetadata:null!=e.AppMetadata?this.mergeRemovalsDict(e.AppMetadata,t.AppMetadata):e.AppMetadata},e)},t.mergeRemovalsDict=function(e,t){var r=s({},e);return Object.keys(e).forEach((function(e){t&&t.hasOwnProperty(e)||delete r[e]})),r},t.overlayDefaults=function(e){return this.logger.verbose("Overlaying input cache with the default cache"),{Account:s({},k,{},e.Account),IdToken:s({},A,{},e.IdToken),AccessToken:s({},E,{},e.AccessToken),RefreshToken:s({},_,{},e.RefreshToken),AppMetadata:s({},O,{},e.AppMetadata)}},e}(),I=function(e){function t(t){return e.call(this,t)||this}return c(t,e),t.prototype.acquireTokenByDeviceCode=function(e){try{var t=this;return t.logger.info("acquireTokenByDeviceCode called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.DeviceCodeClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},t}(function(){function e(e){var t;this.config=f(e),this.logger=new r.Logger(this.config.system.loggerOptions),this.storage=new b(this.logger),this.tokenCache=new S(this.storage,this.logger,null===(t=this.config.cache)||void 0===t?void 0:t.cachePlugin),this.cryptoProvider=new v,r.TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities,this.config.auth.cloudDiscoveryMetadata)}var t,n=e.prototype;return n.getAuthCodeUrl=function(e){try{var t=this;return t.logger.info("getAuthCodeUrl called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.AuthorizationCodeClient(n).getAuthCodeUrl(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.acquireTokenByCode=function(e){try{var t=this;return t.logger.info("acquireTokenByCode called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.AuthorizationCodeClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.acquireTokenByRefreshToken=function(e){try{var t=this;return t.logger.info("acquireTokenByRefreshToken called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.RefreshTokenClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.acquireTokenSilent=function(e){try{var t=this;return Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return new r.SilentFlowClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.getTokenCache=function(){return this.logger.info("getTokenCache called"),this.tokenCache},n.buildOauthClientConfiguration=function(e){try{var t=this;t.logger.verbose("buildOauthClientConfiguration called");var r=t.config.auth.clientId;return Promise.resolve(t.createAuthority(e)).then((function(e){return{authOptions:{clientId:r,authority:e,knownAuthorities:t.config.auth.knownAuthorities,cloudDiscoveryMetadata:t.config.auth.cloudDiscoveryMetadata},loggerOptions:{loggerCallback:t.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:t.config.system.loggerOptions.piiLoggingEnabled},cryptoInterface:t.cryptoProvider,networkInterface:t.config.system.networkClient,storageInterface:t.storage,libraryInfo:{sku:"msal.js.node",version:"1.0.0-alpha.0",cpu:process.arch||"",os:process.platform||""}}}))}catch(e){return Promise.reject(e)}},n.initializeRequestScopes=function(e){return this.logger.verbose("initializeRequestScopes called"),s({},e,{scopes:[].concat(e&&e.scopes||[],[r.Constants.OPENID_SCOPE,r.Constants.PROFILE_SCOPE,r.Constants.OFFLINE_ACCESS_SCOPE])})},n.createAuthority=function(e){try{var t;return this.logger.verbose("createAuthority called"),e?(this.logger.verbose("Authority passed in, creating authority instance"),t=r.AuthorityFactory.createInstance(e,this.config.system.networkClient)):(this.logger.verbose("No authority passed in request, defaulting to authority set on application object"),t=this.authority),t.discoveryComplete()?Promise.resolve(t):Promise.resolve(function(e,r){try{var n=Promise.resolve(t.resolveEndpointsAsync()).then((function(){return t}))}catch(e){return r(e)}return n&&n.then?n.then(void 0,r):n}(0,(function(e){throw r.ClientAuthError.createEndpointDiscoveryIncompleteError(e)})))}catch(e){return Promise.reject(e)}},(t=[{key:"authority",get:function(){return this._authority||(this.logger.verbose("No authority set on application object. Defaulting to common authority"),this._authority=r.AuthorityFactory.createInstance(this.config.auth.authority||r.Constants.DEFAULT_AUTHORITY,this.config.system.networkClient)),this._authority}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}());Object.defineProperty(exports,"AuthError",{enumerable:!0,get:function(){return r.AuthError}}),Object.defineProperty(exports,"AuthErrorMessage",{enumerable:!0,get:function(){return r.AuthErrorMessage}}),Object.defineProperty(exports,"AuthenticationResult",{enumerable:!0,get:function(){return r.AuthenticationResult}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return r.LogLevel}}),Object.defineProperty(exports,"PromptValue",{enumerable:!0,get:function(){return r.PromptValue}}),Object.defineProperty(exports,"ResponseMode",{enumerable:!0,get:function(){return r.ResponseMode}}),exports.ConfidentialClientApplication=function(){},exports.CryptoProvider=v,exports.PublicClientApplication=I,exports.Storage=b,exports.TokenCache=S,exports.buildAppConfiguration=f; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=require("@azure/msal-common"),n=e(require("axios")),o=e(require("debug")),i=require("uuid"),a=e(require("crypto"));function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator"))),function(e){e.GET="get",e.POST="post"}(t||(t={}));var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=function(){function e(){n.defaults.validateStatus=function(){return!0}}var r=e.prototype;return r.sendGetRequestAsync=function(e,r){try{return Promise.resolve(n({method:t.GET,url:e,headers:r&&r.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},r.sendPostRequestAsync=function(e,r){try{return Promise.resolve(n({method:t.POST,url:e,data:r&&r.body||"",headers:r&&r.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},e}(),h={clientId:"",authority:"",knownAuthorities:[],cloudDiscoveryMetadata:""},d={},g={loggerOptions:{loggerCallback:function(e,t,n){o("msal:"+r.LogLevel[e]+(n?"-Pii":""))(t)},piiLoggingEnabled:!1,logLevel:r.LogLevel.Info},networkClient:function(){function e(){}return e.getNetworkClient=function(){return new l},e}().getNetworkClient()};function f(e){var t=e.cache,r=e.system;return{auth:s({},h,{},e.auth),cache:s({},d,{},t),system:s({},g,{},r)}}var p=function(){function e(){}return e.generateGuid=function(){return i.v4()},e.isGuid=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e}(),y=function(){function e(){}return e.base64Encode=function(e){return Buffer.from(e,"utf8").toString("base64")},e.base64EncodeUrl=function(t){return e.base64Encode(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.base64Decode=function(e){return Buffer.from(e,"base64").toString("utf8")},e.base64DecodeUrl=function(t){for(var r=t.replace(/-/g,"+").replace(/_/g,"/");r.length%4;)r+="=";return e.base64Decode(r)},e}(),m=function(){function e(){}var t=e.prototype;return t.generatePkceCodes=function(){try{var e=this.generateCodeVerifier(),t=this.generateCodeChallengeFromVerifier(e);return Promise.resolve({verifier:e,challenge:t})}catch(e){return Promise.reject(e)}},t.generateCodeVerifier=function(){var e=a.randomBytes(32),t=this.bufferToCVString(e);return y.base64EncodeUrl(t)},t.generateCodeChallengeFromVerifier=function(e){return y.base64EncodeUrl(this.sha256(e).toString("ascii"))},t.sha256=function(e){return a.createHash("sha256").update(e).digest()},t.bufferToCVString=function(e){for(var t=[],r=0;r<e.byteLength;r+=1)t.push(u[e[r]%u.length]);return t.join("")},e}(),v=function(){function e(){this.pkceGenerator=new m}var t=e.prototype;return t.createNewGuid=function(){return p.generateGuid()},t.base64Encode=function(e){return y.base64Encode(e)},t.base64Decode=function(e){return y.base64Decode(e)},t.generatePkceCodes=function(){return this.pkceGenerator.generatePkceCodes()},e}(),C=function(){function e(){}return e.deserializeJSONBlob=function(e){return r.StringUtils.isEmpty(e)?{}:JSON.parse(e)},e.deserializeAccounts=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,realm:o.realm,localAccountId:o.local_account_id,username:o.username,authorityType:o.authority_type,name:o.name,clientInfo:o.client_info,lastModificationTime:o.last_modification_time,lastModificationApp:o.last_modification_app},a=new r.AccountEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeIdTokens=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,credentialType:o.credential_type,clientId:o.client_id,secret:o.secret,realm:o.realm},a=new r.IdTokenEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeAccessTokens=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,credentialType:o.credential_type,clientId:o.client_id,secret:o.secret,realm:o.realm,target:o.target,cachedAt:o.cached_at,expiresOn:o.expires_on,extendedExpiresOn:o.extended_expires_on,refreshOn:o.refresh_on,keyId:o.key_id,tokenType:o.token_type},a=new r.AccessTokenEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeRefreshTokens=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={homeAccountId:o.home_account_id,environment:o.environment,credentialType:o.credential_type,clientId:o.client_id,secret:o.secret,familyId:o.family_id,target:o.target,realm:o.realm},a=new r.RefreshTokenEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeAppMetadata=function(e){var t={};return e&&Object.keys(e).map((function(n){var o=e[n],i={clientId:o.client_id,environment:o.environment,familyId:o.family_id},a=new r.AppMetadataEntity;r.CacheManager.toObject(a,i),t[n]=a})),t},e.deserializeAllCache=function(e){return{accounts:e.Account?this.deserializeAccounts(e.Account):{},idTokens:e.IdToken?this.deserializeIdTokens(e.IdToken):{},accessTokens:e.AccessToken?this.deserializeAccessTokens(e.AccessToken):{},refreshTokens:e.RefreshToken?this.deserializeRefreshTokens(e.RefreshToken):{},appMetadata:e.AppMetadata?this.deserializeAppMetadata(e.AppMetadata):{}}},e}(),T=function(){function e(){}return e.serializeJSONBlob=function(e){return JSON.stringify(e)},e.serializeAccounts=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,realm:n.realm,local_account_id:n.localAccountId,username:n.username,authority_type:n.authorityType,name:n.name,client_info:n.clientInfo,last_modification_time:n.lastModificationTime,last_modification_app:n.lastModificationApp}})),t},e.serializeIdTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm}})),t},e.serializeAccessTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm,target:n.target,cached_at:n.cachedAt,expires_on:n.expiresOn,extended_expires_on:n.extendedExpiresOn,refresh_on:n.refreshOn,key_id:n.keyId,token_type:n.tokenType}})),t},e.serializeRefreshTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,family_id:n.familyId,target:n.target,realm:n.realm}})),t},e.serializeAppMetadata=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={client_id:n.clientId,environment:n.environment,family_id:n.familyId}})),t},e.serializeAllCache=function(e){return{Account:this.serializeAccounts(e.accounts),IdToken:this.serializeIdTokens(e.idTokens),AccessToken:this.serializeAccessTokens(e.accessTokens),RefreshToken:this.serializeRefreshTokens(e.refreshTokens),AppMetadata:this.serializeAppMetadata(e.appMetadata)}},e}(),b=function(e){function t(t){var r;return(r=e.call(this)||this).inMemoryCache={accounts:{},accessTokens:{},refreshTokens:{},appMetadata:{},idTokens:{}},r.changeEmitters=[],r.logger=t,r}c(t,e);var n=t.prototype;return n.registerChangeEmitter=function(e){this.changeEmitters.push(e)},n.emitChange=function(){this.changeEmitters.forEach((function(e){return e.call(null)}))},n.getCache=function(){return this.logger.verbose("Getting in-memory cache"),this.inMemoryCache},n.setCache=function(e){this.logger.verbose("Setting in-memory cache"),this.inMemoryCache=e,this.emitChange()},n.setItem=function(e,t,n){this.logger.verbose("setItem called for item type: "+n),this.logger.verbosePii("Item key: "+e);var o=this.getCache();switch(n){case r.CacheSchemaType.ACCOUNT:o.accounts[e]=t;break;case r.CacheSchemaType.CREDENTIAL:switch(r.CredentialEntity.getCredentialType(e)){case r.CredentialType.ID_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ID_TOKEN),o.idTokens[e]=t;break;case r.CredentialType.ACCESS_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ACCESS_TOKEN),o.accessTokens[e]=t;break;case r.CredentialType.REFRESH_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.REFRESH_TOKEN),o.refreshTokens[e]=t}break;case r.CacheSchemaType.APP_META_DATA:o.appMetadata[e]=t;break;default:throw r.ClientAuthError.createInvalidCacheTypeError()}this.setCache(o),this.emitChange()},n.getItem=function(e,t){this.logger.verbose("getItem called for item type: "+t),this.logger.verbosePii("Item key: "+e);var n=this.getCache();switch(t){case r.CacheSchemaType.ACCOUNT:return n.accounts[e]||null;case r.CacheSchemaType.CREDENTIAL:var o=null;switch(r.CredentialEntity.getCredentialType(e)){case r.CredentialType.ID_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ID_TOKEN),o=n.idTokens[e]||null;break;case r.CredentialType.ACCESS_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ACCESS_TOKEN),o=n.accessTokens[e]||null;break;case r.CredentialType.REFRESH_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.REFRESH_TOKEN),o=n.refreshTokens[e]||null}return o;case r.CacheSchemaType.APP_META_DATA:return n.appMetadata[e]||null;default:throw r.ClientAuthError.createInvalidCacheTypeError()}},n.removeItem=function(e,t){this.logger.verbose("removeItem called for item type: "+t),this.logger.verbosePii("Item key: "+e);var n=this.getCache(),o=!1;switch(t){case r.CacheSchemaType.ACCOUNT:n.accounts[e]&&(delete n.accounts[e],o=!0);break;case r.CacheSchemaType.CREDENTIAL:switch(r.CredentialEntity.getCredentialType(e)){case r.CredentialType.ID_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ID_TOKEN),n.idTokens[e]&&(delete n.idTokens[e],o=!0);break;case r.CredentialType.ACCESS_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.ACCESS_TOKEN),n.accessTokens[e]&&(delete n.accessTokens[e],o=!0);break;case r.CredentialType.REFRESH_TOKEN:this.logger.verbose("Credential type: "+r.CredentialType.REFRESH_TOKEN),n.refreshTokens[e]&&(delete n.refreshTokens[e],o=!0)}break;case r.CacheSchemaType.APP_META_DATA:n.appMetadata[e]&&(delete n.appMetadata[e],o=!0);break;default:throw r.ClientAuthError.createInvalidCacheTypeError()}return o&&(this.setCache(n),this.emitChange()),o},n.containsKey=function(e){return!!e},n.getKeys=function(){this.logger.verbose("Retrieving all cache keys");var e=this.getCache();return[].concat(Object.keys(e.accounts),Object.keys(e.idTokens),Object.keys(e.accessTokens),Object.keys(e.refreshTokens),Object.keys(e.appMetadata))},n.clear=function(){var e=this;this.logger.verbose("Clearing cache entries created by MSAL"),this.getKeys().forEach((function(t){e.removeItem(t)})),this.emitChange()},t.generateInMemoryCache=function(e){return C.deserializeAllCache(C.deserializeJSONBlob(e))},t.generateJsonCache=function(e){return T.serializeAllCache(e)},t}(r.CacheManager),k={},A={},E={},_={},O={},S=function(){function e(e,t,r){this.hasChanged=!1,this.storage=e,this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this)),r&&(this.persistence=r),this.logger=t}var t=e.prototype;return t.cacheHasChanged=function(){return this.hasChanged},t.serialize=function(){this.logger.verbose("Serializing in-memory cache");var e=T.serializeAllCache(this.storage.getCache());return r.StringUtils.isEmpty(this.cacheSnapshot)?this.logger.verbose("No cache snapshot to merge"):(this.logger.verbose("Reading cache snapshot from disk"),e=this.mergeState(JSON.parse(this.cacheSnapshot),e)),this.hasChanged=!1,JSON.stringify(e)},t.deserialize=function(e){if(this.logger.verbose("Deserializing JSON to in-memory cache"),this.cacheSnapshot=e,r.StringUtils.isEmpty(this.cacheSnapshot))this.logger.verbose("No cache snapshot to deserialize");else{this.logger.verbose("Reading cache snapshot from disk");var t=C.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));this.storage.setCache(t)}},t.writeToPersistence=function(){try{var e=this;return e.logger.verbose("Writing to persistent cache"),Promise.resolve(function(){if(e.persistence){e.logger.verbose("cachePlugin (persistent cache) not set by the user");var t=T.serializeAllCache(e.storage.getCache());return Promise.resolve(e.persistence.writeToStorage((function(n){return r.StringUtils.isEmpty(n)?e.logger.verbose("No state from disk"):(e.logger.verbose("Reading state from disk"),e.cacheSnapshot=n,t=e.mergeState(JSON.parse(n),t)),JSON.stringify(t)}))).then((function(){e.hasChanged=!1}))}throw r.ClientAuthError.createCachePluginError()}())}catch(e){return Promise.reject(e)}},t.readFromPersistence=function(){try{var e=this;return e.logger.verbose("Reading from persistent cache"),Promise.resolve(function(){if(e.persistence)return e.logger.verbose("cachePlugin (persistent cache) not set by the user"),Promise.resolve(e.persistence.readFromStorage()).then((function(t){if(e.cacheSnapshot=t,r.StringUtils.isEmpty(e.cacheSnapshot))e.logger.verbose("No cache snapshot to overlay and deserialize");else{e.logger.verbose("Reading cache snapshot from disk");var n=e.overlayDefaults(JSON.parse(e.cacheSnapshot));e.logger.verbose("Deserializing JSON");var o=C.deserializeAllCache(n);e.storage.setCache(o)}}));throw r.ClientAuthError.createCachePluginError()}())}catch(e){return Promise.reject(e)}},t.getAllAccounts=function(){return this.logger.verbose("getAllAccounts called"),this.storage.getAllAccounts()},t.removeAccount=function(e){this.logger.verbose("removeAccount called"),this.storage.removeAccount(r.AccountEntity.generateAccountCacheKey(e))},t.handleChangeEvent=function(){this.hasChanged=!0},t.mergeState=function(e,t){this.logger.verbose("Merging in-memory cache with cache snapshot");var r=this.mergeRemovals(e,t);return this.mergeUpdates(r,t)},t.mergeUpdates=function(e,t){var r=this;return Object.keys(t).forEach((function(n){var o=t[n];if(e.hasOwnProperty(n)){var i=null!==o,a="object"==typeof o,s=!Array.isArray(o);i&&a&&s?r.mergeUpdates(e[n],o):e[n]=o}else null!==o&&(e[n]=o)})),e},t.mergeRemovals=function(e,t){return this.logger.verbose("Remove updated entries in cache"),s({Account:null!=e.Account?this.mergeRemovalsDict(e.Account,t.Account):e.Account,AccessToken:null!=e.AccessToken?this.mergeRemovalsDict(e.AccessToken,t.AccessToken):e.AccessToken,RefreshToken:null!=e.RefreshToken?this.mergeRemovalsDict(e.RefreshToken,t.RefreshToken):e.RefreshToken,IdToken:null!=e.IdToken?this.mergeRemovalsDict(e.IdToken,t.IdToken):e.IdToken,AppMetadata:null!=e.AppMetadata?this.mergeRemovalsDict(e.AppMetadata,t.AppMetadata):e.AppMetadata},e)},t.mergeRemovalsDict=function(e,t){var r=s({},e);return Object.keys(e).forEach((function(e){t&&t.hasOwnProperty(e)||delete r[e]})),r},t.overlayDefaults=function(e){return this.logger.verbose("Overlaying input cache with the default cache"),{Account:s({},k,{},e.Account),IdToken:s({},A,{},e.IdToken),AccessToken:s({},E,{},e.AccessToken),RefreshToken:s({},_,{},e.RefreshToken),AppMetadata:s({},O,{},e.AppMetadata)}},e}(),I=function(e){function t(t){return e.call(this,t)||this}return c(t,e),t.prototype.acquireTokenByDeviceCode=function(e){try{var t=this;return t.logger.info("acquireTokenByDeviceCode called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.DeviceCodeClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},t}(function(){function e(e){var t;this.config=f(e),this.logger=new r.Logger(this.config.system.loggerOptions),this.storage=new b(this.logger),this.tokenCache=new S(this.storage,this.logger,null===(t=this.config.cache)||void 0===t?void 0:t.cachePlugin),this.cryptoProvider=new v,r.TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities,this.config.auth.cloudDiscoveryMetadata)}var t,n=e.prototype;return n.getAuthCodeUrl=function(e){try{var t=this;return t.logger.info("getAuthCodeUrl called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.AuthorizationCodeClient(n).getAuthCodeUrl(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.acquireTokenByCode=function(e){try{var t=this;return t.logger.info("acquireTokenByCode called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.AuthorizationCodeClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.acquireTokenByRefreshToken=function(e){try{var t=this;return t.logger.info("acquireTokenByRefreshToken called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return t.logger.verbose("Auth client config generated"),new r.RefreshTokenClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.acquireTokenSilent=function(e){try{var t=this;return Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(n){return new r.SilentFlowClient(n).acquireToken(t.initializeRequestScopes(e))}))}catch(e){return Promise.reject(e)}},n.getTokenCache=function(){return this.logger.info("getTokenCache called"),this.tokenCache},n.buildOauthClientConfiguration=function(e){try{var t=this;t.logger.verbose("buildOauthClientConfiguration called");var r=t.config.auth.clientId;return Promise.resolve(t.createAuthority(e)).then((function(e){return{authOptions:{clientId:r,authority:e,knownAuthorities:t.config.auth.knownAuthorities,cloudDiscoveryMetadata:t.config.auth.cloudDiscoveryMetadata},loggerOptions:{loggerCallback:t.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:t.config.system.loggerOptions.piiLoggingEnabled},cryptoInterface:t.cryptoProvider,networkInterface:t.config.system.networkClient,storageInterface:t.storage,libraryInfo:{sku:"msal.js.node",version:"1.0.0-alpha.2",cpu:process.arch||"",os:process.platform||""}}}))}catch(e){return Promise.reject(e)}},n.initializeRequestScopes=function(e){return this.logger.verbose("initializeRequestScopes called"),s({},e,{scopes:[].concat(e&&e.scopes||[],[r.Constants.OPENID_SCOPE,r.Constants.PROFILE_SCOPE,r.Constants.OFFLINE_ACCESS_SCOPE])})},n.createAuthority=function(e){try{var t;return this.logger.verbose("createAuthority called"),e?(this.logger.verbose("Authority passed in, creating authority instance"),t=r.AuthorityFactory.createInstance(e,this.config.system.networkClient)):(this.logger.verbose("No authority passed in request, defaulting to authority set on application object"),t=this.authority),t.discoveryComplete()?Promise.resolve(t):Promise.resolve(function(e,r){try{var n=Promise.resolve(t.resolveEndpointsAsync()).then((function(){return t}))}catch(e){return r(e)}return n&&n.then?n.then(void 0,r):n}(0,(function(e){throw r.ClientAuthError.createEndpointDiscoveryIncompleteError(e)})))}catch(e){return Promise.reject(e)}},(t=[{key:"authority",get:function(){return this._authority||(this.logger.verbose("No authority set on application object. Defaulting to common authority"),this._authority=r.AuthorityFactory.createInstance(this.config.auth.authority||r.Constants.DEFAULT_AUTHORITY,this.config.system.networkClient)),this._authority}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}());Object.defineProperty(exports,"AuthError",{enumerable:!0,get:function(){return r.AuthError}}),Object.defineProperty(exports,"AuthErrorMessage",{enumerable:!0,get:function(){return r.AuthErrorMessage}}),Object.defineProperty(exports,"AuthenticationResult",{enumerable:!0,get:function(){return r.AuthenticationResult}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return r.LogLevel}}),Object.defineProperty(exports,"PromptValue",{enumerable:!0,get:function(){return r.PromptValue}}),Object.defineProperty(exports,"ResponseMode",{enumerable:!0,get:function(){return r.ResponseMode}}),exports.ConfidentialClientApplication=function(){},exports.CryptoProvider=v,exports.PublicClientApplication=I,exports.Storage=b,exports.TokenCache=S,exports.buildAppConfiguration=f; | ||
//# sourceMappingURL=msal-node.cjs.production.min.js.map |
@@ -1131,3 +1131,3 @@ import { LogLevel, StringUtils, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ClientAuthError, CacheSchemaType, CredentialEntity, CredentialType, AuthorizationCodeClient, RefreshTokenClient, SilentFlowClient, Constants as Constants$1, AuthorityFactory, Logger, TrustedAuthority, DeviceCodeClient } from '@azure/msal-common'; | ||
var version = "1.0.0-alpha.0"; | ||
var version = "1.0.0-alpha.2"; | ||
@@ -1134,0 +1134,0 @@ var defaultSerializedCache = { |
{ | ||
"name": "@azure/msal-node", | ||
"version": "1.0.0-alpha.0", | ||
"version": "1.0.0-alpha.2", | ||
"author": { | ||
@@ -14,5 +14,4 @@ "name": "Microsoft", | ||
}, | ||
"description": "Microsoft Authentication Library for js", | ||
"description": "Microsoft Authentication Library for Node", | ||
"keywords": [ | ||
"implicit", | ||
"js", | ||
@@ -80,3 +79,3 @@ "ts", | ||
"dependencies": { | ||
"@azure/msal-common": "1.0.0-beta.4", | ||
"@azure/msal-common": "^1.0.0", | ||
"axios": "^0.19.2", | ||
@@ -83,0 +82,0 @@ "debug": "^4.1.1" |
@@ -1,2 +0,2 @@ | ||
# (Alpha) Microsoft Authentication Library for JavaScript for Node(msal-node) for Node.js based Web apps | ||
# Microsoft Authentication Library for Node (msal-node) | ||
@@ -8,3 +8,3 @@ [![npm version](https://img.shields.io/npm/v/@azure/msal-node.svg?style=flat)](https://www.npmjs.com/package/@azure/msal-node/)[![npm version](https://img.shields.io/npm/dm/@azure/msal-node.svg)](https://nodei.co/npm/@azure/msal-node/)[![Coverage Status](https://coveralls.io/repos/github/AzureAD/microsoft-authentication-library-for-js/badge.svg?branch=dev)](https://coveralls.io/github/AzureAD/microsoft-authentication-library-for-js?branch=dev) | ||
Currently `msal-node` library is under development, Please track the project progress [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/projects/4). This documentation is also in progress and will be changing as we release our `alpha` patches. **We do not recommend using this in a production environment yet**. | ||
Currently `msal-node` is under development, please track the project progress [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/projects/4). This documentation is also in progress and will be changing as we release our `alpha` patches. **We do not recommend using this in a production environment yet**. | ||
@@ -25,9 +25,8 @@ 1. [About](#about) | ||
The MSAL library for Node.js enables desktop and web applications for Node.js to authenticate users using [Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io). | ||
MSAL Node enables applications to authenticate users using [Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io). | ||
The `@azure/msal-node` package has a dependency on `@azure/msal-common` package, which is the common engine for all future javascript based libraries. | ||
### OAuth grant types supported and upcoming: | ||
### OAuth2.0 grant types supported: | ||
The current alpha version supports the below OAuth grant types: | ||
The current alpha version supports the following ways of acquiring tokens: | ||
@@ -37,11 +36,13 @@ - [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) with [PKCE](https://oauth.net/2/pkce/) | ||
- [Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/) | ||
- Silent Flow (user convenience flow to acquire a token silently) | ||
- [Silent Flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-acquire-cache-tokens#acquiring-tokens-silently-from-the-cache) | ||
[Coming Soon] In the upcoming quarters we plan to add support for Confidential client flows: | ||
[Coming Soon] In the upcoming quarters we plan to add support for: | ||
- [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) with client secret | ||
- [Authorization Code Grant (Confidential Client)](https://oauth.net/2/grant-types/authorization-code/) | ||
- [Client Credential Grant](https://oauth.net/2/grant-types/client-credentials/) | ||
- [On-behalf-of flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow) | ||
- [Integrated Windows Authentication flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#integrated-windows-authentication) | ||
- [Username and Password flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#usernamepassword) | ||
More details on different grant types supported by Microsoft authentication libraries in general can be found [here](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows) | ||
More details on different grant types supported by Microsoft authentication libraries in general can be found [here](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows). | ||
@@ -56,7 +57,7 @@ ### Scenarios supported: | ||
More details on scenarios and the authentication flows that map to each of them can be found [here](https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-flows-app-scenarios) | ||
More details on scenarios and the authentication flows that map to each of them can be found [here](https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-flows-app-scenarios). | ||
## FAQ | ||
See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/FAQ.md). | ||
See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/faq.md). | ||
@@ -84,7 +85,6 @@ ## Releases | ||
``` | ||
## Usage | ||
### MSAL basics | ||
- Initialize a Public Client Application(https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-public-client-application.md) | ||
- [Initialize a Public Client Application](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-public-client-application.md) | ||
- [Configuration](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/configuration.md) | ||
@@ -100,4 +100,4 @@ - [Request](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/request.md) | ||
- [refresh-token](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-node-samples/refresh-token): Command line app using OAuth 2.0 refresh flow. | ||
- [silent-flow](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-node-samples/silent-flow): Express app using OAuth2.0 authorization code flow and refresh token flow to demonstrate silent retrieval of tokens when already logged in or when the app provides a in-disk cache for Single sign on experience | ||
- msal-node-extensions (`Coming soon`): Uses the msal-extensions library to write the MSAL in-memory token cache to a disk. | ||
- [silent-flow](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-node-samples/silent-flow): Express app using OAuth2.0 authorization code flow to acquire a token and store in the token cache, and silent flow to use tokens in the token cache. | ||
- [msal-node-extensions](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-extensions): Uses authorization code flow to acquire tokens then the [msal-extensions](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/msal-node-extensions) library to write the MSAL in-memory token cache to disk. | ||
@@ -155,3 +155,3 @@ ## Build and Test | ||
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (the "License"); | ||
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. | ||
@@ -158,0 +158,0 @@ ## We Value and Adhere to the Microsoft Open Source Code of Conduct |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
515537
+ Added@azure/msal-common@1.7.2(transitive)
- Removed@azure/msal-common@1.0.0-beta.4(transitive)
Updated@azure/msal-common@^1.0.0