msal-iframe-ok
Version:
Fork to allow silent renewal in iFrame of Microsoft Authentication Library for js
53 lines • 2.07 kB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { Utils } from "./Utils";
/**
* accountIdentifier combination of idToken.uid and idToken.utid
* homeAccountIdentifier combination of clientInfo.uid and clientInfo.utid
* userName idToken.preferred_username
* name idToken.name
* idToken idToken
* sid idToken.sid - session identifier
* environment idtoken.issuer (the authority that issues the token)
*/
var Account = /** @class */ (function () {
/**
* Creates an Account Object
* @praram accountIdentifier
* @param homeAccountIdentifier
* @param userName
* @param name
* @param idToken
* @param sid
* @param environment
*/
function Account(accountIdentifier, homeAccountIdentifier, userName, name, idToken, sid, environment) {
this.accountIdentifier = accountIdentifier;
this.homeAccountIdentifier = homeAccountIdentifier;
this.userName = userName;
this.name = name;
this.idToken = idToken;
this.sid = sid;
this.environment = environment;
}
/**
* @hidden
* @param idToken
* @param clientInfo
*/
Account.createAccount = function (idToken, clientInfo) {
// create accountIdentifier
var accountIdentifier = idToken.objectId || idToken.subject;
// create homeAccountIdentifier
var uid = clientInfo ? clientInfo.uid : "";
var utid = clientInfo ? clientInfo.utid : "";
var homeAccountIdentifier;
if (!Utils.isEmpty(uid) && !Utils.isEmpty(utid)) {
homeAccountIdentifier = Utils.base64EncodeStringUrlSafe(uid) + "." + Utils.base64EncodeStringUrlSafe(utid);
}
return new Account(accountIdentifier, homeAccountIdentifier, idToken.preferredName, idToken.name, idToken.decodedIdToken, idToken.sid, idToken.issuer);
};
return Account;
}());
export { Account };
//# sourceMappingURL=Account.js.map