msal
Version:
Microsoft Authentication Library for js
55 lines • 1.77 kB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { CryptoUtils } from "./utils/CryptoUtils";
import { ClientAuthError } from "./error/ClientAuthError";
import { StringUtils } from "./utils/StringUtils";
/**
* @hidden
*/
var ClientInfo = /** @class */ (function () {
function ClientInfo(rawClientInfo) {
if (!rawClientInfo || StringUtils.isEmpty(rawClientInfo)) {
this.uid = "";
this.utid = "";
return;
}
try {
var decodedClientInfo = CryptoUtils.base64Decode(rawClientInfo);
var clientInfo = JSON.parse(decodedClientInfo);
if (clientInfo) {
if (clientInfo.hasOwnProperty("uid")) {
this.uid = clientInfo.uid;
}
if (clientInfo.hasOwnProperty("utid")) {
this.utid = clientInfo.utid;
}
}
}
catch (e) {
throw ClientAuthError.createClientInfoDecodingError(e);
}
}
Object.defineProperty(ClientInfo.prototype, "uid", {
get: function () {
return this._uid ? this._uid : "";
},
set: function (uid) {
this._uid = uid;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientInfo.prototype, "utid", {
get: function () {
return this._utid ? this._utid : "";
},
set: function (utid) {
this._utid = utid;
},
enumerable: true,
configurable: true
});
return ClientInfo;
}());
export { ClientInfo };
//# sourceMappingURL=ClientInfo.js.map