@hclsoftware/secagent
Version:
IAST agent
51 lines (39 loc) • 1.12 kB
JavaScript
//IASTIGNORE
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2025.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
'use strict'
const Utils = require('./Utils/Utils')
class CookieIast {
constructor (name, value) {
this.name = name.toString()
this.value = value.toString()
const hash = Utils.createHashObject()
hash.update(this.name)
hash.update(this.value)
this.hashCode = hash.produce()
}
getName () {
return this.name
}
getValue () {
return this.value
}
// Checks specified object is "equal to" current object or not
equals (cookie) {
if (cookie == null) {
return false
}
// call equals() method of the underlying objects
return this.value === cookie.value && this.name === cookie.name
}
toString () {
// return String.format("Cookie - Name: %s, Value: %s", name, value);
return `Cookie - Name: ${this.name}, Value: ${this.value}`
}
}
module.exports = CookieIast