@carboncollins/mobileconfig
Version:
Create and sign iOS mobileconfig configuration files
170 lines (139 loc) • 8.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _payload = require('./payload.js');
var _payload2 = _interopRequireDefault(_payload);
var _safe = require('../safe.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @class ActiveDirectoryCertificate
* @description Structured model data for the Active Directory Certificate payload
* @author CarbonCollins <toastyghost@carboncollins.uk>
* @memberof module:@carboncollins/mobileconfig
* @extends module:@carboncollins/mobileconfig.MobileConfigPayload
*/
var ActiveDirectoryCertificate = function (_MobileConfigPayload) {
_inherits(ActiveDirectoryCertificate, _MobileConfigPayload);
/**
* @constructor
* @description creates an instance of ActiveDirectoryCertificate
* @param {Object|module:@carboncollins/mobileconfig.ActiveDirectoryCertificate} [options={}] An object of
* options
*/
function ActiveDirectoryCertificate() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, ActiveDirectoryCertificate);
/**
* @member {Boolean} allowAllAppsAccess
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description If true, apps have access to the private key.
*/
var _this = _possibleConstructorReturn(this, (ActiveDirectoryCertificate.__proto__ || Object.getPrototypeOf(ActiveDirectoryCertificate)).call(this, Object.assign({}, options, { type: 'com.apple.ADCertificate.managed' })));
_this.allowAllAppsAccess = options.allowAllAppsAccess || null;
/**
* @member {String} server
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description Fully qualified host name of the Active Directory issuing CA.
*/
_this.server = options.server || null;
/**
* @member {String} template
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description Template Name as it appears in the General tab of the template’s object in the
* Certificate Templates’ Microsoft Management Console snap-in component.
*/
_this.template = options.template || null;
/**
* @member {String} acquisitionMechanism
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description Most commonly `RPC`. If using ‘Web enrollment,’ `HTTP`.
*/
_this.acquisitionMechanism = options.acquisitionMechanism || null;
/**
* @member {String} authority
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description Name of the CA. This value is determined from the Common Name (CN) of the
* Active Directory entry: CN=<your CA name>, CN='Certification Authorities', CN='Public Key
* Services', CN='Services', or CN='Configuration', <your base Domain Name>.
*/
_this.authority = options.authority || null;
/**
* @member {Number} renewalTimeInterval
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description Number of days in advance of certificate expiration that the notification
* center will notify the user.
*/
_this.renewalTimeInterval = options.renewalTimeInterval || null;
/**
* @member {String} description
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description User-friendly description of the certification identity.
*/
_this.description = options.description || null;
/**
* @member {Boolean} keyIsExtractable
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description If true, the private key can be exported.
*/
_this.keyIsExtractable = options.keyIsExtractable || null;
/**
* @member {Boolean} promptForCredentials
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description This key applies only to user certificates where Manual Download is the chosen
* method of profile delivery. If true, the user will be prompted for credentials when the
* profile is installed. Omit this key for computer certificates.
*/
_this.promptForCredentials = options.promptForCredentials || null;
/**
* @member {Number} [keysize=2048]
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description Optional; defaults to 2048. The RSA key size for the Certificate Signing
* Request (CSR). Availability: Available in macOS 10.11 and later.
*/
_this.keysize = options.keysize || 2048;
/**
* @member {Boolean} [enableAutoRenewal=false]
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @description Optional. If set to true, the certificate obtained with this payload will
* attempt auto-renewal. Only applies to device Active Directory certificate payloads.
* Availability: Available in macOS 10.13.4 and later.
*/
_this.enableAutoRenewal = options.enableAutoRenewal || false;
return _this;
}
/**
* @description generates a plist safe js object with all the required information for generating
* a mobileconfig profile
* @readonly
* @memberof module:@carboncollins/mobileconfig.ActiveDirectoryCertificate
* @author CarbonCollins <toastyghost@carboncollins.uk>
* @returns {Object} a plist object encoded into a js object
*/
_createClass(ActiveDirectoryCertificate, [{
key: 'plistSafeObject',
get: function get() {
var plistObj = {
AllowAllAppsAccess: (0, _safe.toSafeBoolean)(this.allowAllAppsAccess),
CertServer: (0, _safe.toSafeString)(this.server),
CertTemplate: (0, _safe.toSafeString)(this.template),
CertificateAcquisitionMechanism: (0, _safe.toSafeString)(this.acquisitionMechanism),
CertificateAuthority: (0, _safe.toSafeString)(this.authority),
CertificateRenewalTimeInterval: (0, _safe.toSafeInteger)(this.renewalTimeInterval),
Description: (0, _safe.toSafeString)(this.description),
KeyIsExtractable: (0, _safe.toSafeBoolean)(this.keyIsExtractable),
PromptForCredentials: (0, _safe.toSafeBoolean)(this.promptForCredentials),
Keysize: (0, _safe.toSafeInteger)(this.keysize),
EnableAutoRenewal: (0, _safe.toSafeBoolean)(this.enableAutoRenewal)
};
return Object.assign({}, _get(ActiveDirectoryCertificate.prototype.__proto__ || Object.getPrototypeOf(ActiveDirectoryCertificate.prototype), 'plistSafeObject', this), plistObj);
}
}]);
return ActiveDirectoryCertificate;
}(_payload2.default);
exports.default = ActiveDirectoryCertificate;