passbolt-styleguide
Version:
Passbolt styleguide contains common styling assets used by the different sites, plugin, etc.
75 lines (67 loc) • 2.01 kB
JavaScript
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 5.11.0
*/
import EntityV2 from "../abstract/entityV2";
import SmtpSettingsEntity from "./smtpSettingsEntity";
const ENTITY_NAME = "SmtpUsernamePasswordAuthentication";
/**
* Entity for SMTP username & password authentication method
*/
class SmtpUsernamePasswordAuthenticationEntity extends EntityV2 {
/**
* Get the entity schema
* @returns {object}
*/
static getSchema() {
return {
type: "object",
required: [...SmtpSettingsEntity.getSchema().required, "username", "password"],
properties: {
...SmtpSettingsEntity.getSchema().properties,
username: {
type: "string",
maxLength: 256,
},
password: {
type: "string",
maxLength: 4096,
},
},
};
}
/**
* Marshall the entity
* Coerce port from string to integer (the API may return port as a string).
*/
marshall() {
if (typeof this._props.port === "string") {
this._props.port = parseInt(this._props.port, 10);
}
super.marshall();
}
/**
* Get the default data for this authentication method.
* @returns {object}
*/
static getDefaultData() {
return { username: "", password: "", tenant_id: null, client_id: null, client_secret: null };
}
/**
* Get the entity name
* @returns {string}
*/
static get ENTITY_NAME() {
return ENTITY_NAME;
}
}
export default SmtpUsernamePasswordAuthenticationEntity;