diffusion
Version:
Diffusion JavaScript client
55 lines (54 loc) • 1.83 kB
JavaScript
;
/**
* @module Features.Security
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.connectionActionFromString = exports.CONNECTION_ACTION = exports.SystemAuthentication = void 0;
var enumerize_1 = require("./../../util/enumerize");
/**
* Implementation of {@link SystemAuthenticationConfiguration}
*
* @inheritdoc
*/
var SystemAuthentication = /** @class */ (function () {
function SystemAuthentication(principals, action, roles, properties) {
if (principals === void 0) { principals = []; }
if (roles === void 0) { roles = []; }
if (properties === void 0) { properties = {}; }
this.principals = principals;
this.anonymous = {
action: action,
roles: roles
};
this.trustedClientProposedProperties = properties;
}
/**
* Convert object to string
*
* @return a string representation of the SystemAuthentication
*/
SystemAuthentication.prototype.toString = function () {
return "SystemAuthenticationConfiguration [principals=" + this.principals + ", anonymous=" + this.anonymous + "]";
};
return SystemAuthentication;
}());
exports.SystemAuthentication = SystemAuthentication;
/**
* An enum-like object containing all possible connection actions
*/
exports.CONNECTION_ACTION = {
ALLOW: { id: 0, value: 'allow' },
DENY: { id: 1, value: 'deny' },
ABSTAIN: { id: 2, value: 'abstain' }
};
enumerize_1.enumerize(exports.CONNECTION_ACTION);
/**
* Get a connection action from a string
*
* @param val the string
* @return a connection action obtained from the string
*/
function connectionActionFromString(val) {
return exports.CONNECTION_ACTION[val.toUpperCase()];
}
exports.connectionActionFromString = connectionActionFromString;