@sap/xssec
Version:
XS Advanced Container Security API for node.js
47 lines (37 loc) • 1.14 kB
JavaScript
const Token = require("./Token");
class IdentityServiceToken extends Token {
get appTid() {
return this.payload.app_tid ?? this.payload.zone_uuid;
}
/**
* Returns the Identity Service APIs consumed by the caller (based on the token's 'ias_apis' claim).
* @returns {string[]} The consumed APIs or [] if the caller does not consume any APIs.
*/
get consumedApis() {
return this.payload.ias_apis || [];
}
get customIssuer() {
return this.payload.ias_iss ? this.payload.iss : null;
}
get issuer() {
return this.payload.ias_iss || this.payload.iss;
}
/**
* Returns the SCIM id of the user.
* @returns {string} The SCIM id or undefined if the token does not contain a SCIM id, e.g. because it is a technical user token.
*/
get scimId() {
return this.payload.scim_id;
}
// Methods for backward-compatibility
getAppTID() {
return this.appTid;
}
getCustomIssuer() {
return this.customIssuer;
}
getZoneId() {
return this.appTid;
}
}
module.exports = IdentityServiceToken;