@ngageoint/mage.service 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/mage.service.js +230 -0
- package/bin/migration.js +60 -0
- package/bin/poststop.sh +1 -0
- package/bin/prestart.sh +1 -0
- package/lib/@types/express/index.d.ts +18 -0
- package/lib/@types/geojson-validation/index.d.ts +15 -0
- package/lib/@types/mongodb-migrations/index.d.ts +99 -0
- package/lib/access/index.d.ts +21 -0
- package/lib/access/index.d.ts.map +1 -0
- package/lib/access/index.js +40 -0
- package/lib/access/index.js.map +1 -0
- package/lib/adapters/adapters.controllers.web.d.ts +22 -0
- package/lib/adapters/adapters.controllers.web.d.ts.map +1 -0
- package/lib/adapters/adapters.controllers.web.js +55 -0
- package/lib/adapters/adapters.controllers.web.js.map +1 -0
- package/lib/adapters/adapters.db.mongoose.d.ts +5 -0
- package/lib/adapters/adapters.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/adapters.db.mongoose.js +70 -0
- package/lib/adapters/adapters.db.mongoose.js.map +1 -0
- package/lib/adapters/adapters.simple_id_factory.d.ts +5 -0
- package/lib/adapters/adapters.simple_id_factory.d.ts.map +1 -0
- package/lib/adapters/adapters.simple_id_factory.js +24 -0
- package/lib/adapters/adapters.simple_id_factory.js.map +1 -0
- package/lib/adapters/base/adapters.base.db.mongoose.d.ts +59 -0
- package/lib/adapters/base/adapters.base.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/base/adapters.base.db.mongoose.js +143 -0
- package/lib/adapters/base/adapters.base.db.mongoose.js.map +1 -0
- package/lib/adapters/events/adapters.events.controllers.web.d.ts +14 -0
- package/lib/adapters/events/adapters.events.controllers.web.d.ts.map +1 -0
- package/lib/adapters/events/adapters.events.controllers.web.js +83 -0
- package/lib/adapters/events/adapters.events.controllers.web.js.map +1 -0
- package/lib/adapters/events/adapters.events.db.mongoose.d.ts +27 -0
- package/lib/adapters/events/adapters.events.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/events/adapters.events.db.mongoose.js +127 -0
- package/lib/adapters/events/adapters.events.db.mongoose.js.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.d.ts +25 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.d.ts.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.js +234 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.js.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.d.ts +63 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.js +199 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.js.map +1 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.d.ts +7 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.d.ts.map +1 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.js +13 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.js.map +1 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.d.ts +10 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.d.ts.map +1 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.js +118 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.js.map +1 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.d.ts +38 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.js +287 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.js.map +1 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.d.ts +29 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.d.ts.map +1 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.js +274 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.js.map +1 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.d.ts +40 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.d.ts.map +1 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.js +196 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.js.map +1 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.d.ts +30 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.js +294 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.js.map +1 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.d.ts +17 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.js +59 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.js.map +1 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.d.ts +38 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.d.ts.map +1 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.js +110 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.js.map +1 -0
- package/lib/adapters/users/adapters.users.controllers.web.d.ts +7 -0
- package/lib/adapters/users/adapters.users.controllers.web.d.ts.map +1 -0
- package/lib/adapters/users/adapters.users.controllers.web.js +37 -0
- package/lib/adapters/users/adapters.users.controllers.web.js.map +1 -0
- package/lib/adapters/users/adapters.users.db.mongoose.d.ts +19 -0
- package/lib/adapters/users/adapters.users.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/users/adapters.users.db.mongoose.js +126 -0
- package/lib/adapters/users/adapters.users.db.mongoose.js.map +1 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.d.ts +3 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.d.ts.map +1 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.js +53 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.js.map +1 -0
- package/lib/api/attachment.d.ts +12 -0
- package/lib/api/attachment.d.ts.map +1 -0
- package/lib/api/attachment.js +81 -0
- package/lib/api/attachment.js.map +1 -0
- package/lib/api/event.d.ts +20 -0
- package/lib/api/event.d.ts.map +1 -0
- package/lib/api/event.js +185 -0
- package/lib/api/event.js.map +1 -0
- package/lib/api/events/location.d.ts +11 -0
- package/lib/api/events/location.d.ts.map +1 -0
- package/lib/api/events/location.js +13 -0
- package/lib/api/events/location.js.map +1 -0
- package/lib/api/events/observation.d.ts +15 -0
- package/lib/api/events/observation.d.ts.map +1 -0
- package/lib/api/events/observation.js +21 -0
- package/lib/api/events/observation.js.map +1 -0
- package/lib/api/feature.d.ts +8 -0
- package/lib/api/feature.d.ts.map +1 -0
- package/lib/api/feature.js +15 -0
- package/lib/api/feature.js.map +1 -0
- package/lib/api/field/attachmentField.d.ts +12 -0
- package/lib/api/field/attachmentField.d.ts.map +1 -0
- package/lib/api/field/attachmentField.js +40 -0
- package/lib/api/field/attachmentField.js.map +1 -0
- package/lib/api/field/checkboxField.d.ts +7 -0
- package/lib/api/field/checkboxField.d.ts.map +1 -0
- package/lib/api/field/checkboxField.js +19 -0
- package/lib/api/field/checkboxField.js.map +1 -0
- package/lib/api/field/dateField.d.ts +8 -0
- package/lib/api/field/dateField.d.ts.map +1 -0
- package/lib/api/field/dateField.js +21 -0
- package/lib/api/field/dateField.js.map +1 -0
- package/lib/api/field/emailField.d.ts +7 -0
- package/lib/api/field/emailField.d.ts.map +1 -0
- package/lib/api/field/emailField.js +19 -0
- package/lib/api/field/emailField.js.map +1 -0
- package/lib/api/field/field.d.ts +12 -0
- package/lib/api/field/field.d.ts.map +1 -0
- package/lib/api/field/field.js +12 -0
- package/lib/api/field/field.js.map +1 -0
- package/lib/api/field/geometryField.d.ts +7 -0
- package/lib/api/field/geometryField.d.ts.map +1 -0
- package/lib/api/field/geometryField.js +35 -0
- package/lib/api/field/geometryField.js.map +1 -0
- package/lib/api/field/index.d.ts +7 -0
- package/lib/api/field/index.d.ts.map +1 -0
- package/lib/api/field/index.js +30 -0
- package/lib/api/field/index.js.map +1 -0
- package/lib/api/field/multiSelectField.d.ts +7 -0
- package/lib/api/field/multiSelectField.d.ts.map +1 -0
- package/lib/api/field/multiSelectField.js +27 -0
- package/lib/api/field/multiSelectField.js.map +1 -0
- package/lib/api/field/numberField.d.ts +7 -0
- package/lib/api/field/numberField.d.ts.map +1 -0
- package/lib/api/field/numberField.js +27 -0
- package/lib/api/field/numberField.js.map +1 -0
- package/lib/api/field/selectField.d.ts +7 -0
- package/lib/api/field/selectField.d.ts.map +1 -0
- package/lib/api/field/selectField.js +22 -0
- package/lib/api/field/selectField.js.map +1 -0
- package/lib/api/field/textField.d.ts +7 -0
- package/lib/api/field/textField.d.ts.map +1 -0
- package/lib/api/field/textField.js +21 -0
- package/lib/api/field/textField.js.map +1 -0
- package/lib/api/form.d.ts +12 -0
- package/lib/api/form.d.ts.map +1 -0
- package/lib/api/form.js +239 -0
- package/lib/api/form.js.map +1 -0
- package/lib/api/icon.d.ts +22 -0
- package/lib/api/icon.d.ts.map +1 -0
- package/lib/api/icon.js +178 -0
- package/lib/api/icon.js.map +1 -0
- package/lib/api/index.d.ts +10 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +11 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/layer.d.ts +14 -0
- package/lib/api/layer.d.ts.map +1 -0
- package/lib/api/layer.js +70 -0
- package/lib/api/layer.js.map +1 -0
- package/lib/api/location.d.ts +14 -0
- package/lib/api/location.d.ts.map +1 -0
- package/lib/api/location.js +35 -0
- package/lib/api/location.js.map +1 -0
- package/lib/api/observation.d.ts +25 -0
- package/lib/api/observation.d.ts.map +1 -0
- package/lib/api/observation.js +224 -0
- package/lib/api/observation.js.map +1 -0
- package/lib/api/user.d.ts +16 -0
- package/lib/api/user.d.ts.map +1 -0
- package/lib/api/user.js +250 -0
- package/lib/api/user.js.map +1 -0
- package/lib/app.api/app.api.errors.d.ts +42 -0
- package/lib/app.api/app.api.errors.d.ts.map +1 -0
- package/lib/app.api/app.api.errors.js +43 -0
- package/lib/app.api/app.api.errors.js.map +1 -0
- package/lib/app.api/app.api.global.d.ts +74 -0
- package/lib/app.api/app.api.global.d.ts.map +1 -0
- package/lib/app.api/app.api.global.js +59 -0
- package/lib/app.api/app.api.global.js.map +1 -0
- package/lib/app.api/events/app.api.events.d.ts +31 -0
- package/lib/app.api/events/app.api.events.d.ts.map +1 -0
- package/lib/app.api/events/app.api.events.js +3 -0
- package/lib/app.api/events/app.api.events.js.map +1 -0
- package/lib/app.api/feeds/app.api.feeds.d.ts +139 -0
- package/lib/app.api/feeds/app.api.feeds.d.ts.map +1 -0
- package/lib/app.api/feeds/app.api.feeds.js +26 -0
- package/lib/app.api/feeds/app.api.feeds.js.map +1 -0
- package/lib/app.api/icons/app.api.icons.d.ts +60 -0
- package/lib/app.api/icons/app.api.icons.d.ts.map +1 -0
- package/lib/app.api/icons/app.api.icons.js +29 -0
- package/lib/app.api/icons/app.api.icons.js.map +1 -0
- package/lib/app.api/observations/app.api.observations.d.ts +126 -0
- package/lib/app.api/observations/app.api.observations.d.ts.map +1 -0
- package/lib/app.api/observations/app.api.observations.js +61 -0
- package/lib/app.api/observations/app.api.observations.js.map +1 -0
- package/lib/app.api/users/app.api.users.d.ts +24 -0
- package/lib/app.api/users/app.api.users.d.ts.map +1 -0
- package/lib/app.api/users/app.api.users.js +3 -0
- package/lib/app.api/users/app.api.users.js.map +1 -0
- package/lib/app.d.ts +38 -0
- package/lib/app.d.ts.map +1 -0
- package/lib/app.impl/events/app.impl.events.d.ts +8 -0
- package/lib/app.impl/events/app.impl.events.d.ts.map +1 -0
- package/lib/app.impl/events/app.impl.events.js +107 -0
- package/lib/app.impl/events/app.impl.events.js.map +1 -0
- package/lib/app.impl/feeds/app.impl.feeds.d.ts +21 -0
- package/lib/app.impl/feeds/app.impl.feeds.d.ts.map +1 -0
- package/lib/app.impl/feeds/app.impl.feeds.js +527 -0
- package/lib/app.impl/feeds/app.impl.feeds.js.map +1 -0
- package/lib/app.impl/icons/app.impl.icons.d.ts +7 -0
- package/lib/app.impl/icons/app.impl.icons.d.ts.map +1 -0
- package/lib/app.impl/icons/app.impl.icons.js +81 -0
- package/lib/app.impl/icons/app.impl.icons.js.map +1 -0
- package/lib/app.impl/observations/app.impl.observations.d.ts +11 -0
- package/lib/app.impl/observations/app.impl.observations.d.ts.map +1 -0
- package/lib/app.impl/observations/app.impl.observations.js +357 -0
- package/lib/app.impl/observations/app.impl.observations.js.map +1 -0
- package/lib/app.impl/users/app.impl.users.d.ts +4 -0
- package/lib/app.impl/users/app.impl.users.d.ts.map +1 -0
- package/lib/app.impl/users/app.impl.users.js +37 -0
- package/lib/app.impl/users/app.impl.users.js.map +1 -0
- package/lib/app.js +507 -0
- package/lib/app.js.map +1 -0
- package/lib/assets/default-icon.png +0 -0
- package/lib/authentication/anonymous.d.ts +6 -0
- package/lib/authentication/anonymous.d.ts.map +1 -0
- package/lib/authentication/anonymous.js +17 -0
- package/lib/authentication/anonymous.js.map +1 -0
- package/lib/authentication/index.d.ts +24 -0
- package/lib/authentication/index.d.ts.map +1 -0
- package/lib/authentication/index.js +104 -0
- package/lib/authentication/index.js.map +1 -0
- package/lib/authentication/ldap.d.ts +2 -0
- package/lib/authentication/ldap.d.ts.map +1 -0
- package/lib/authentication/ldap.js +130 -0
- package/lib/authentication/ldap.js.map +1 -0
- package/lib/authentication/local.d.ts +2 -0
- package/lib/authentication/local.d.ts.map +1 -0
- package/lib/authentication/local.js +77 -0
- package/lib/authentication/local.js.map +1 -0
- package/lib/authentication/oauth.d.ts +2 -0
- package/lib/authentication/oauth.d.ts.map +1 -0
- package/lib/authentication/oauth.js +197 -0
- package/lib/authentication/oauth.js.map +1 -0
- package/lib/authentication/openidconnect.d.ts +2 -0
- package/lib/authentication/openidconnect.d.ts.map +1 -0
- package/lib/authentication/openidconnect.js +148 -0
- package/lib/authentication/openidconnect.js.map +1 -0
- package/lib/authentication/saml.d.ts +2 -0
- package/lib/authentication/saml.d.ts.map +1 -0
- package/lib/authentication/saml.js +287 -0
- package/lib/authentication/saml.js.map +1 -0
- package/lib/authentication/verification.d.ts +33 -0
- package/lib/authentication/verification.d.ts.map +1 -0
- package/lib/authentication/verification.js +144 -0
- package/lib/authentication/verification.js.map +1 -0
- package/lib/config.d.ts +15 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +20 -0
- package/lib/config.js.map +1 -0
- package/lib/dist-package.json +203 -0
- package/lib/docs/auth/local.yaml +90 -0
- package/lib/docs/geojson.yaml +375 -0
- package/lib/docs/openapi.yaml +4591 -0
- package/lib/entities/authentication/entities.authentication.d.ts +14 -0
- package/lib/entities/authentication/entities.authentication.d.ts.map +1 -0
- package/lib/entities/authentication/entities.authentication.js +3 -0
- package/lib/entities/authentication/entities.authentication.js.map +1 -0
- package/lib/entities/authorization/entities.authorization.d.ts +7 -0
- package/lib/entities/authorization/entities.authorization.d.ts.map +1 -0
- package/lib/entities/authorization/entities.authorization.js +3 -0
- package/lib/entities/authorization/entities.authorization.js.map +1 -0
- package/lib/entities/authorization/entities.permissions.d.ts +143 -0
- package/lib/entities/authorization/entities.permissions.d.ts.map +1 -0
- package/lib/entities/authorization/entities.permissions.js +101 -0
- package/lib/entities/authorization/entities.permissions.js.map +1 -0
- package/lib/entities/entities.domain_events.d.ts +1 -0
- package/lib/entities/entities.domain_events.d.ts.map +1 -0
- package/lib/entities/entities.domain_events.js +20 -0
- package/lib/entities/entities.domain_events.js.map +1 -0
- package/lib/entities/entities.global.d.ts +107 -0
- package/lib/entities/entities.global.d.ts.map +1 -0
- package/lib/entities/entities.global.js +67 -0
- package/lib/entities/entities.global.js.map +1 -0
- package/lib/entities/entities.i18n.d.ts +78 -0
- package/lib/entities/entities.i18n.d.ts.map +1 -0
- package/lib/entities/entities.i18n.js +69 -0
- package/lib/entities/entities.i18n.js.map +1 -0
- package/lib/entities/entities.json_types.d.ts +42 -0
- package/lib/entities/entities.json_types.d.ts.map +1 -0
- package/lib/entities/entities.json_types.js +3 -0
- package/lib/entities/entities.json_types.js.map +1 -0
- package/lib/entities/events/entities.events.d.ts +118 -0
- package/lib/entities/events/entities.events.d.ts.map +1 -0
- package/lib/entities/events/entities.events.forms.d.ts +132 -0
- package/lib/entities/events/entities.events.forms.d.ts.map +1 -0
- package/lib/entities/events/entities.events.forms.js +102 -0
- package/lib/entities/events/entities.events.forms.js.map +1 -0
- package/lib/entities/events/entities.events.js +146 -0
- package/lib/entities/events/entities.events.js.map +1 -0
- package/lib/entities/feeds/entities.feeds.d.ts +340 -0
- package/lib/entities/feeds/entities.feeds.d.ts.map +1 -0
- package/lib/entities/feeds/entities.feeds.js +213 -0
- package/lib/entities/feeds/entities.feeds.js.map +1 -0
- package/lib/entities/icons/entities.icons.d.ts +106 -0
- package/lib/entities/icons/entities.icons.d.ts.map +1 -0
- package/lib/entities/icons/entities.icons.js +26 -0
- package/lib/entities/icons/entities.icons.js.map +1 -0
- package/lib/entities/observations/entities.observations.d.ts +569 -0
- package/lib/entities/observations/entities.observations.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.attachment.d.ts +5 -0
- package/lib/entities/observations/entities.observations.fields.attachment.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.attachment.js +24 -0
- package/lib/entities/observations/entities.observations.fields.attachment.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.js +17 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.d.ts +20 -0
- package/lib/entities/observations/entities.observations.fields.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.date.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.date.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.date.js +21 -0
- package/lib/entities/observations/entities.observations.fields.date.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.email.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.email.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.email.js +20 -0
- package/lib/entities/observations/entities.observations.fields.email.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.geometry.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.geometry.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.geometry.js +62 -0
- package/lib/entities/observations/entities.observations.fields.geometry.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.js +37 -0
- package/lib/entities/observations/entities.observations.fields.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.js +24 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.numeric.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.numeric.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.numeric.js +24 -0
- package/lib/entities/observations/entities.observations.fields.numeric.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.required.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.required.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.required.js +14 -0
- package/lib/entities/observations/entities.observations.fields.required.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.select.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.select.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.select.js +17 -0
- package/lib/entities/observations/entities.observations.fields.select.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.text.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.text.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.text.js +15 -0
- package/lib/entities/observations/entities.observations.fields.text.js.map +1 -0
- package/lib/entities/observations/entities.observations.js +873 -0
- package/lib/entities/observations/entities.observations.js.map +1 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.d.ts +98 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.d.ts.map +1 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.js +30 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.js.map +1 -0
- package/lib/entities/teams/entities.teams.d.ts +26 -0
- package/lib/entities/teams/entities.teams.d.ts.map +1 -0
- package/lib/entities/teams/entities.teams.js +3 -0
- package/lib/entities/teams/entities.teams.js.map +1 -0
- package/lib/entities/users/entities.users.d.ts +66 -0
- package/lib/entities/users/entities.users.d.ts.map +1 -0
- package/lib/entities/users/entities.users.js +10 -0
- package/lib/entities/users/entities.users.js.map +1 -0
- package/lib/environment/env.d.ts +29 -0
- package/lib/environment/env.d.ts.map +1 -0
- package/lib/environment/env.js +106 -0
- package/lib/environment/env.js.map +1 -0
- package/lib/export/csv.d.ts +11 -0
- package/lib/export/csv.d.ts.map +1 -0
- package/lib/export/csv.js +243 -0
- package/lib/export/csv.js.map +1 -0
- package/lib/export/exporter.d.ts +12 -0
- package/lib/export/exporter.d.ts.map +1 -0
- package/lib/export/exporter.js +38 -0
- package/lib/export/exporter.js.map +1 -0
- package/lib/export/exporterFactory.d.ts +11 -0
- package/lib/export/exporterFactory.d.ts.map +1 -0
- package/lib/export/exporterFactory.js +17 -0
- package/lib/export/exporterFactory.js.map +1 -0
- package/lib/export/geojson.d.ts +10 -0
- package/lib/export/geojson.d.ts.map +1 -0
- package/lib/export/geojson.js +167 -0
- package/lib/export/geojson.js.map +1 -0
- package/lib/export/geopackage.d.ts +25 -0
- package/lib/export/geopackage.d.ts.map +1 -0
- package/lib/export/geopackage.js +687 -0
- package/lib/export/geopackage.js.map +1 -0
- package/lib/export/kml.d.ts +10 -0
- package/lib/export/kml.d.ts.map +1 -0
- package/lib/export/kml.js +128 -0
- package/lib/export/kml.js.map +1 -0
- package/lib/export/kmlWriter.d.ts +24 -0
- package/lib/export/kmlWriter.d.ts.map +1 -0
- package/lib/export/kmlWriter.js +431 -0
- package/lib/export/kmlWriter.js.map +1 -0
- package/lib/express.d.ts +9 -0
- package/lib/express.d.ts.map +1 -0
- package/lib/express.js +70 -0
- package/lib/express.js.map +1 -0
- package/lib/format/geoJsonFormat.d.ts +3 -0
- package/lib/format/geoJsonFormat.d.ts.map +1 -0
- package/lib/format/geoJsonFormat.js +65 -0
- package/lib/format/geoJsonFormat.js.map +1 -0
- package/lib/logger.d.ts +2 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +21 -0
- package/lib/logger.js.map +1 -0
- package/lib/main.impl/main.impl.plugins.d.ts +12 -0
- package/lib/main.impl/main.impl.plugins.d.ts.map +1 -0
- package/lib/main.impl/main.impl.plugins.js +41 -0
- package/lib/main.impl/main.impl.plugins.js.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.d.ts +3 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.d.ts.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.js +32 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.js.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.d.ts +4 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.d.ts.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.js +26 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.js.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.d.ts +4 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.d.ts.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.js +41 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.js.map +1 -0
- package/lib/migrate.d.ts +4 -0
- package/lib/migrate.d.ts.map +1 -0
- package/lib/migrate.js +96 -0
- package/lib/migrate.js.map +1 -0
- package/lib/migrations/002-create-user-role.d.ts +4 -0
- package/lib/migrations/002-create-user-role.d.ts.map +1 -0
- package/lib/migrations/002-create-user-role.js +30 -0
- package/lib/migrations/002-create-user-role.js.map +1 -0
- package/lib/migrations/003-create-admin-role.d.ts +4 -0
- package/lib/migrations/003-create-admin-role.d.ts.map +1 -0
- package/lib/migrations/003-create-admin-role.js +31 -0
- package/lib/migrations/003-create-admin-role.js.map +1 -0
- package/lib/migrations/005-create-osm-layer.d.ts +4 -0
- package/lib/migrations/005-create-osm-layer.d.ts.map +1 -0
- package/lib/migrations/005-create-osm-layer.js +51 -0
- package/lib/migrations/005-create-osm-layer.js.map +1 -0
- package/lib/migrations/006-event-teams.d.ts +4 -0
- package/lib/migrations/006-event-teams.d.ts.map +1 -0
- package/lib/migrations/006-event-teams.js +40 -0
- package/lib/migrations/006-event-teams.js.map +1 -0
- package/lib/migrations/007-user-icon.d.ts +4 -0
- package/lib/migrations/007-user-icon.d.ts.map +1 -0
- package/lib/migrations/007-user-icon.js +21 -0
- package/lib/migrations/007-user-icon.js.map +1 -0
- package/lib/migrations/008-create-user-no-edit-role.d.ts +4 -0
- package/lib/migrations/008-create-user-no-edit-role.d.ts.map +1 -0
- package/lib/migrations/008-create-user-no-edit-role.js +34 -0
- package/lib/migrations/008-create-user-no-edit-role.js.map +1 -0
- package/lib/migrations/009-create-manager-role.d.ts +4 -0
- package/lib/migrations/009-create-manager-role.d.ts.map +1 -0
- package/lib/migrations/009-create-manager-role.js +50 -0
- package/lib/migrations/009-create-manager-role.js.map +1 -0
- package/lib/migrations/010-add-user-device-manager-role.d.ts +4 -0
- package/lib/migrations/010-add-user-device-manager-role.d.ts.map +1 -0
- package/lib/migrations/010-add-user-device-manager-role.js +38 -0
- package/lib/migrations/010-add-user-device-manager-role.js.map +1 -0
- package/lib/migrations/011-multiple-forms.d.ts +4 -0
- package/lib/migrations/011-multiple-forms.d.ts.map +1 -0
- package/lib/migrations/011-multiple-forms.js +161 -0
- package/lib/migrations/011-multiple-forms.js.map +1 -0
- package/lib/migrations/012-user-role-remove-delete.d.ts +4 -0
- package/lib/migrations/012-user-role-remove-delete.d.ts.map +1 -0
- package/lib/migrations/012-user-role-remove-delete.js +15 -0
- package/lib/migrations/012-user-role-remove-delete.js.map +1 -0
- package/lib/migrations/013-ensure-event-indexes.d.ts +4 -0
- package/lib/migrations/013-ensure-event-indexes.d.ts.map +1 -0
- package/lib/migrations/013-ensure-event-indexes.js +50 -0
- package/lib/migrations/013-ensure-event-indexes.js.map +1 -0
- package/lib/migrations/014-add-role-update-permission.d.ts +4 -0
- package/lib/migrations/014-add-role-update-permission.d.ts.map +1 -0
- package/lib/migrations/014-add-role-update-permission.js +15 -0
- package/lib/migrations/014-add-role-update-permission.js.map +1 -0
- package/lib/migrations/015-manager-role-add-user-create.d.ts +4 -0
- package/lib/migrations/015-manager-role-add-user-create.d.ts.map +1 -0
- package/lib/migrations/015-manager-role-add-user-create.js +15 -0
- package/lib/migrations/015-manager-role-add-user-create.js.map +1 -0
- package/lib/migrations/016-set-feed-primary-secondary.d.ts +4 -0
- package/lib/migrations/016-set-feed-primary-secondary.d.ts.map +1 -0
- package/lib/migrations/016-set-feed-primary-secondary.js +36 -0
- package/lib/migrations/016-set-feed-primary-secondary.js.map +1 -0
- package/lib/migrations/017-make-layers-available.d.ts +4 -0
- package/lib/migrations/017-make-layers-available.d.ts.map +1 -0
- package/lib/migrations/017-make-layers-available.js +48 -0
- package/lib/migrations/017-make-layers-available.js.map +1 -0
- package/lib/migrations/018-feeds-admin-permissions.d.ts +4 -0
- package/lib/migrations/018-feeds-admin-permissions.d.ts.map +1 -0
- package/lib/migrations/018-feeds-admin-permissions.js +32 -0
- package/lib/migrations/018-feeds-admin-permissions.js.map +1 -0
- package/lib/migrations/018-set-default-password-policy.d.ts +4 -0
- package/lib/migrations/018-set-default-password-policy.d.ts.map +1 -0
- package/lib/migrations/018-set-default-password-policy.js +58 -0
- package/lib/migrations/018-set-default-password-policy.js.map +1 -0
- package/lib/migrations/019-move-user-authentication.d.ts +4 -0
- package/lib/migrations/019-move-user-authentication.d.ts.map +1 -0
- package/lib/migrations/019-move-user-authentication.js +68 -0
- package/lib/migrations/019-move-user-authentication.js.map +1 -0
- package/lib/migrations/020-add-export-permissions.d.ts +4 -0
- package/lib/migrations/020-add-export-permissions.d.ts.map +1 -0
- package/lib/migrations/020-add-export-permissions.js +36 -0
- package/lib/migrations/020-add-export-permissions.js.map +1 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.d.ts +4 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.d.ts.map +1 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.js +86 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.js.map +1 -0
- package/lib/migrations/023-move-local-auth-from-settings.d.ts +4 -0
- package/lib/migrations/023-move-local-auth-from-settings.d.ts.map +1 -0
- package/lib/migrations/023-move-local-auth-from-settings.js +54 -0
- package/lib/migrations/023-move-local-auth-from-settings.js.map +1 -0
- package/lib/migrations/024-link-auth-to-auth-config.d.ts +4 -0
- package/lib/migrations/024-link-auth-to-auth-config.d.ts.map +1 -0
- package/lib/migrations/024-link-auth-to-auth-config.js +59 -0
- package/lib/migrations/024-link-auth-to-auth-config.js.map +1 -0
- package/lib/migrations/025-add-auth-config-permissions.d.ts +4 -0
- package/lib/migrations/025-add-auth-config-permissions.d.ts.map +1 -0
- package/lib/migrations/025-add-auth-config-permissions.js +32 -0
- package/lib/migrations/025-add-auth-config-permissions.js.map +1 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.d.ts +4 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.d.ts.map +1 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.js +59 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.js.map +1 -0
- package/lib/migrations/029-attachment-form-field.d.ts +4 -0
- package/lib/migrations/029-attachment-form-field.d.ts.map +1 -0
- package/lib/migrations/029-attachment-form-field.js +130 -0
- package/lib/migrations/029-attachment-form-field.js.map +1 -0
- package/lib/models/authentication.d.ts +17 -0
- package/lib/models/authentication.d.ts.map +1 -0
- package/lib/models/authentication.js +174 -0
- package/lib/models/authentication.js.map +1 -0
- package/lib/models/authenticationconfiguration.d.ts +15 -0
- package/lib/models/authenticationconfiguration.d.ts.map +1 -0
- package/lib/models/authenticationconfiguration.js +105 -0
- package/lib/models/authenticationconfiguration.js.map +1 -0
- package/lib/models/cappedLocation.d.ts +8 -0
- package/lib/models/cappedLocation.d.ts.map +1 -0
- package/lib/models/cappedLocation.js +78 -0
- package/lib/models/cappedLocation.js.map +1 -0
- package/lib/models/counter.d.ts +3 -0
- package/lib/models/counter.d.ts.map +1 -0
- package/lib/models/counter.js +37 -0
- package/lib/models/counter.js.map +1 -0
- package/lib/models/device.d.ts +14 -0
- package/lib/models/device.d.ts.map +1 -0
- package/lib/models/device.js +220 -0
- package/lib/models/device.js.map +1 -0
- package/lib/models/event.d.ts +75 -0
- package/lib/models/event.d.ts.map +1 -0
- package/lib/models/event.js +839 -0
- package/lib/models/event.js.map +1 -0
- package/lib/models/export.d.ts +18 -0
- package/lib/models/export.d.ts.map +1 -0
- package/lib/models/export.js +107 -0
- package/lib/models/export.js.map +1 -0
- package/lib/models/feature.d.ts +4 -0
- package/lib/models/feature.d.ts.map +1 -0
- package/lib/models/feature.js +43 -0
- package/lib/models/feature.js.map +1 -0
- package/lib/models/icon.d.ts +9 -0
- package/lib/models/icon.d.ts.map +1 -0
- package/lib/models/icon.js +69 -0
- package/lib/models/icon.js.map +1 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/index.d.ts.map +1 -0
- package/lib/models/index.js +12 -0
- package/lib/models/index.js.map +1 -0
- package/lib/models/layer.d.ts +13 -0
- package/lib/models/layer.d.ts.map +1 -0
- package/lib/models/layer.js +149 -0
- package/lib/models/layer.js.map +1 -0
- package/lib/models/location.d.ts +8 -0
- package/lib/models/location.d.ts.map +1 -0
- package/lib/models/location.js +96 -0
- package/lib/models/location.js.map +1 -0
- package/lib/models/login.d.ts +4 -0
- package/lib/models/login.d.ts.map +1 -0
- package/lib/models/login.js +90 -0
- package/lib/models/login.js.map +1 -0
- package/lib/models/observation.d.ts +93 -0
- package/lib/models/observation.d.ts.map +1 -0
- package/lib/models/observation.js +461 -0
- package/lib/models/observation.js.map +1 -0
- package/lib/models/role.d.ts +22 -0
- package/lib/models/role.d.ts.map +1 -0
- package/lib/models/role.js +80 -0
- package/lib/models/role.js.map +1 -0
- package/lib/models/setting.d.ts +6 -0
- package/lib/models/setting.d.ts.map +1 -0
- package/lib/models/setting.js +31 -0
- package/lib/models/setting.js.map +1 -0
- package/lib/models/team.d.ts +31 -0
- package/lib/models/team.d.ts.map +1 -0
- package/lib/models/team.js +511 -0
- package/lib/models/team.js.map +1 -0
- package/lib/models/token.d.ts +6 -0
- package/lib/models/token.d.ts.map +1 -0
- package/lib/models/token.js +68 -0
- package/lib/models/token.js.map +1 -0
- package/lib/models/user.d.ts +60 -0
- package/lib/models/user.d.ts.map +1 -0
- package/lib/models/user.js +400 -0
- package/lib/models/user.js.map +1 -0
- package/lib/permissions/permissions.events.d.ts +69 -0
- package/lib/permissions/permissions.events.d.ts.map +1 -0
- package/lib/permissions/permissions.events.js +154 -0
- package/lib/permissions/permissions.events.js.map +1 -0
- package/lib/permissions/permissions.feeds.d.ts +19 -0
- package/lib/permissions/permissions.feeds.d.ts.map +1 -0
- package/lib/permissions/permissions.feeds.js +58 -0
- package/lib/permissions/permissions.feeds.js.map +1 -0
- package/lib/permissions/permissions.icons.d.ts +9 -0
- package/lib/permissions/permissions.icons.d.ts.map +1 -0
- package/lib/permissions/permissions.icons.js +28 -0
- package/lib/permissions/permissions.icons.js.map +1 -0
- package/lib/permissions/permissions.observations.d.ts +14 -0
- package/lib/permissions/permissions.observations.d.ts.map +1 -0
- package/lib/permissions/permissions.observations.js +113 -0
- package/lib/permissions/permissions.observations.js.map +1 -0
- package/lib/permissions/permissions.role-based.base.d.ts +15 -0
- package/lib/permissions/permissions.role-based.base.d.ts.map +1 -0
- package/lib/permissions/permissions.role-based.base.js +14 -0
- package/lib/permissions/permissions.role-based.base.js.map +1 -0
- package/lib/permissions/permissions.users.d.ts +8 -0
- package/lib/permissions/permissions.users.d.ts.map +1 -0
- package/lib/permissions/permissions.users.js +23 -0
- package/lib/permissions/permissions.users.js.map +1 -0
- package/lib/plugins.api/index.d.ts +55 -0
- package/lib/plugins.api/index.d.ts.map +1 -0
- package/lib/plugins.api/index.js +5 -0
- package/lib/plugins.api/index.js.map +1 -0
- package/lib/plugins.api/plugins.api.db.d.ts +7 -0
- package/lib/plugins.api/plugins.api.db.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.db.js +5 -0
- package/lib/plugins.api/plugins.api.db.js.map +1 -0
- package/lib/plugins.api/plugins.api.events.d.ts +24 -0
- package/lib/plugins.api/plugins.api.events.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.events.js +5 -0
- package/lib/plugins.api/plugins.api.events.js.map +1 -0
- package/lib/plugins.api/plugins.api.feeds.d.ts +35 -0
- package/lib/plugins.api/plugins.api.feeds.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.feeds.js +12 -0
- package/lib/plugins.api/plugins.api.feeds.js.map +1 -0
- package/lib/plugins.api/plugins.api.icons.d.ts +21 -0
- package/lib/plugins.api/plugins.api.icons.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.icons.js +5 -0
- package/lib/plugins.api/plugins.api.icons.js.map +1 -0
- package/lib/plugins.api/plugins.api.observations.d.ts +10 -0
- package/lib/plugins.api/plugins.api.observations.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.observations.js +11 -0
- package/lib/plugins.api/plugins.api.observations.js.map +1 -0
- package/lib/plugins.api/plugins.api.users.d.ts +4 -0
- package/lib/plugins.api/plugins.api.users.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.users.js +5 -0
- package/lib/plugins.api/plugins.api.users.js.map +1 -0
- package/lib/plugins.api/plugins.api.web.d.ts +10 -0
- package/lib/plugins.api/plugins.api.web.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.web.js +3 -0
- package/lib/plugins.api/plugins.api.web.js.map +1 -0
- package/lib/provision/index.d.ts +23 -0
- package/lib/provision/index.d.ts.map +1 -0
- package/lib/provision/index.js +60 -0
- package/lib/provision/index.js.map +1 -0
- package/lib/provision/none.d.ts +3 -0
- package/lib/provision/none.d.ts.map +1 -0
- package/lib/provision/none.js +41 -0
- package/lib/provision/none.js.map +1 -0
- package/lib/provision/strategies/none.d.ts +9 -0
- package/lib/provision/strategies/none.d.ts.map +1 -0
- package/lib/provision/strategies/none.js +25 -0
- package/lib/provision/strategies/none.js.map +1 -0
- package/lib/provision/strategies/uid.d.ts +9 -0
- package/lib/provision/strategies/uid.d.ts.map +1 -0
- package/lib/provision/strategies/uid.js +28 -0
- package/lib/provision/strategies/uid.js.map +1 -0
- package/lib/provision/uid.d.ts +3 -0
- package/lib/provision/uid.d.ts.map +1 -0
- package/lib/provision/uid.js +43 -0
- package/lib/provision/uid.js.map +1 -0
- package/lib/routes/authenticationconfigurations.d.ts +3 -0
- package/lib/routes/authenticationconfigurations.d.ts.map +1 -0
- package/lib/routes/authenticationconfigurations.js +209 -0
- package/lib/routes/authenticationconfigurations.js.map +1 -0
- package/lib/routes/devices.d.ts +3 -0
- package/lib/routes/devices.d.ts.map +1 -0
- package/lib/routes/devices.js +201 -0
- package/lib/routes/devices.js.map +1 -0
- package/lib/routes/events.d.ts +47 -0
- package/lib/routes/events.d.ts.map +1 -0
- package/lib/routes/events.js +495 -0
- package/lib/routes/events.js.map +1 -0
- package/lib/routes/exports.d.ts +3 -0
- package/lib/routes/exports.d.ts.map +1 -0
- package/lib/routes/exports.js +204 -0
- package/lib/routes/exports.js.map +1 -0
- package/lib/routes/imports.d.ts +3 -0
- package/lib/routes/imports.d.ts.map +1 -0
- package/lib/routes/imports.js +41 -0
- package/lib/routes/imports.js.map +1 -0
- package/lib/routes/index.d.ts +3 -0
- package/lib/routes/index.d.ts.map +1 -0
- package/lib/routes/index.js +151 -0
- package/lib/routes/index.js.map +1 -0
- package/lib/routes/layers.d.ts +3 -0
- package/lib/routes/layers.d.ts.map +1 -0
- package/lib/routes/layers.js +433 -0
- package/lib/routes/layers.js.map +1 -0
- package/lib/routes/locations.d.ts +3 -0
- package/lib/routes/locations.d.ts.map +1 -0
- package/lib/routes/locations.js +124 -0
- package/lib/routes/locations.js.map +1 -0
- package/lib/routes/logins.d.ts +3 -0
- package/lib/routes/logins.d.ts.map +1 -0
- package/lib/routes/logins.js +64 -0
- package/lib/routes/logins.js.map +1 -0
- package/lib/routes/observations.d.ts +3 -0
- package/lib/routes/observations.d.ts.map +1 -0
- package/lib/routes/observations.js +363 -0
- package/lib/routes/observations.js.map +1 -0
- package/lib/routes/plugins.d.ts +3 -0
- package/lib/routes/plugins.d.ts.map +1 -0
- package/lib/routes/plugins.js +29 -0
- package/lib/routes/plugins.js.map +1 -0
- package/lib/routes/roles.d.ts +3 -0
- package/lib/routes/roles.d.ts.map +1 -0
- package/lib/routes/roles.js +64 -0
- package/lib/routes/roles.js.map +1 -0
- package/lib/routes/settings.d.ts +3 -0
- package/lib/routes/settings.d.ts.map +1 -0
- package/lib/routes/settings.js +21 -0
- package/lib/routes/settings.js.map +1 -0
- package/lib/routes/setup.d.ts +3 -0
- package/lib/routes/setup.d.ts.map +1 -0
- package/lib/routes/setup.js +90 -0
- package/lib/routes/setup.js.map +1 -0
- package/lib/routes/teams.d.ts +3 -0
- package/lib/routes/teams.d.ts.map +1 -0
- package/lib/routes/teams.js +213 -0
- package/lib/routes/teams.js.map +1 -0
- package/lib/routes/users.d.ts +3 -0
- package/lib/routes/users.d.ts.map +1 -0
- package/lib/routes/users.js +478 -0
- package/lib/routes/users.js.map +1 -0
- package/lib/schedule/export/export-task.d.ts +14 -0
- package/lib/schedule/export/export-task.d.ts.map +1 -0
- package/lib/schedule/export/export-task.js +70 -0
- package/lib/schedule/export/export-task.js.map +1 -0
- package/lib/schedule/index.d.ts +2 -0
- package/lib/schedule/index.d.ts.map +1 -0
- package/lib/schedule/index.js +27 -0
- package/lib/schedule/index.js.map +1 -0
- package/lib/security/key-mgt/key-mgt-factory.d.ts +7 -0
- package/lib/security/key-mgt/key-mgt-factory.d.ts.map +1 -0
- package/lib/security/key-mgt/key-mgt-factory.js +10 -0
- package/lib/security/key-mgt/key-mgt-factory.js.map +1 -0
- package/lib/security/key-mgt/plaintext-key-manager.d.ts +42 -0
- package/lib/security/key-mgt/plaintext-key-manager.d.ts.map +1 -0
- package/lib/security/key-mgt/plaintext-key-manager.js +52 -0
- package/lib/security/key-mgt/plaintext-key-manager.js.map +1 -0
- package/lib/security/responses/data-response.d.ts +13 -0
- package/lib/security/responses/data-response.d.ts.map +1 -0
- package/lib/security/responses/data-response.js +25 -0
- package/lib/security/responses/data-response.js.map +1 -0
- package/lib/security/secret-store-service.d.ts +39 -0
- package/lib/security/secret-store-service.d.ts.map +1 -0
- package/lib/security/secret-store-service.js +94 -0
- package/lib/security/secret-store-service.js.map +1 -0
- package/lib/security/storage/file-system-secret-store.d.ts +17 -0
- package/lib/security/storage/file-system-secret-store.d.ts.map +1 -0
- package/lib/security/storage/file-system-secret-store.js +46 -0
- package/lib/security/storage/file-system-secret-store.js.map +1 -0
- package/lib/security/storage/json-provider.d.ts +6 -0
- package/lib/security/storage/json-provider.d.ts.map +1 -0
- package/lib/security/storage/json-provider.js +17 -0
- package/lib/security/storage/json-provider.js.map +1 -0
- package/lib/security/utilities/secure-property-appender.d.ts +8 -0
- package/lib/security/utilities/secure-property-appender.d.ts.map +1 -0
- package/lib/security/utilities/secure-property-appender.js +39 -0
- package/lib/security/utilities/secure-property-appender.js.map +1 -0
- package/lib/transformers/authenticationconfiguration.d.ts +2 -0
- package/lib/transformers/authenticationconfiguration.d.ts.map +1 -0
- package/lib/transformers/authenticationconfiguration.js +22 -0
- package/lib/transformers/authenticationconfiguration.js.map +1 -0
- package/lib/transformers/export.d.ts +2 -0
- package/lib/transformers/export.d.ts.map +1 -0
- package/lib/transformers/export.js +13 -0
- package/lib/transformers/export.js.map +1 -0
- package/lib/transformers/geojson.d.ts +2 -0
- package/lib/transformers/geojson.d.ts.map +1 -0
- package/lib/transformers/geojson.js +24 -0
- package/lib/transformers/geojson.js.map +1 -0
- package/lib/transformers/layer.d.ts +2 -0
- package/lib/transformers/layer.d.ts.map +1 -0
- package/lib/transformers/layer.js +13 -0
- package/lib/transformers/layer.js.map +1 -0
- package/lib/transformers/observation.d.ts +2 -0
- package/lib/transformers/observation.d.ts.map +1 -0
- package/lib/transformers/observation.js +13 -0
- package/lib/transformers/observation.js.map +1 -0
- package/lib/transformers/pageinfo.d.ts +2 -0
- package/lib/transformers/pageinfo.d.ts.map +1 -0
- package/lib/transformers/pageinfo.js +27 -0
- package/lib/transformers/pageinfo.js.map +1 -0
- package/lib/transformers/user.d.ts +2 -0
- package/lib/transformers/user.d.ts.map +1 -0
- package/lib/transformers/user.js +21 -0
- package/lib/transformers/user.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/upload.d.ts +8 -0
- package/lib/upload.d.ts.map +1 -0
- package/lib/upload.js +30 -0
- package/lib/upload.js.map +1 -0
- package/lib/utilities/authenticationApiAppender.d.ts +10 -0
- package/lib/utilities/authenticationApiAppender.d.ts.map +1 -0
- package/lib/utilities/authenticationApiAppender.js +48 -0
- package/lib/utilities/authenticationApiAppender.js.map +1 -0
- package/lib/utilities/filterParser.d.ts +2 -0
- package/lib/utilities/filterParser.d.ts.map +1 -0
- package/lib/utilities/filterParser.js +87 -0
- package/lib/utilities/filterParser.js.map +1 -0
- package/lib/utilities/geopackage.d.ts +56 -0
- package/lib/utilities/geopackage.d.ts.map +1 -0
- package/lib/utilities/geopackage.js +335 -0
- package/lib/utilities/geopackage.js.map +1 -0
- package/lib/utilities/loader.d.ts +9 -0
- package/lib/utilities/loader.d.ts.map +1 -0
- package/lib/utilities/loader.js +25 -0
- package/lib/utilities/loader.js.map +1 -0
- package/lib/utilities/paging.d.ts +15 -0
- package/lib/utilities/paging.d.ts.map +1 -0
- package/lib/utilities/paging.js +56 -0
- package/lib/utilities/paging.js.map +1 -0
- package/lib/utilities/passwordValidator.d.ts +8 -0
- package/lib/utilities/passwordValidator.d.ts.map +1 -0
- package/lib/utilities/passwordValidator.js +175 -0
- package/lib/utilities/passwordValidator.js.map +1 -0
- package/lib/utilities/pbkdf2.d.ts +6 -0
- package/lib/utilities/pbkdf2.d.ts.map +1 -0
- package/lib/utilities/pbkdf2.js +79 -0
- package/lib/utilities/pbkdf2.js.map +1 -0
- package/lib/utilities/togeojson.d.ts +2 -0
- package/lib/utilities/togeojson.d.ts.map +1 -0
- package/lib/utilities/togeojson.js +308 -0
- package/lib/utilities/togeojson.js.map +1 -0
- package/lib/utilities/waitForMongooseConnection.d.ts +3 -0
- package/lib/utilities/waitForMongooseConnection.d.ts.map +1 -0
- package/lib/utilities/waitForMongooseConnection.js +34 -0
- package/lib/utilities/waitForMongooseConnection.js.map +1 -0
- package/lib/utilities/whitelist.d.ts +2 -0
- package/lib/utilities/whitelist.d.ts.map +1 -0
- package/lib/utilities/whitelist.js +18 -0
- package/lib/utilities/whitelist.js.map +1 -0
- package/lib/views/authentication.pug +10 -0
- package/lib/views/oauth.pug +12 -0
- package/lib/views/observation.pug +137 -0
- package/package.json +203 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const OpenIdConnectStrategy = require('passport-openidconnect').Strategy, log = require('winston'), User = require('../models/user'), Role = require('../models/role'), TokenAssertion = require('./verification').TokenAssertion, api = require('../api'), { app, passport, tokenService } = require('./index');
|
|
3
|
+
function configure(strategy) {
|
|
4
|
+
log.info(`Configuring ${strategy.title} authentication`);
|
|
5
|
+
passport.use(strategy.name, new OpenIdConnectStrategy({
|
|
6
|
+
clientID: strategy.settings.clientID,
|
|
7
|
+
clientSecret: strategy.settings.clientSecret,
|
|
8
|
+
issuer: strategy.settings.issuer,
|
|
9
|
+
authorizationURL: strategy.settings.authorizationURL,
|
|
10
|
+
tokenURL: strategy.settings.tokenURL,
|
|
11
|
+
userInfoURL: strategy.settings.profileURL,
|
|
12
|
+
callbackURL: `/auth/${strategy.name}/callback`,
|
|
13
|
+
scope: strategy.settings.scope
|
|
14
|
+
}, function (issuer, uiProfile, profile, context, idToken, accessToken, refreshToken, params, done) {
|
|
15
|
+
const jsonProfile = uiProfile._json;
|
|
16
|
+
const profileId = jsonProfile[strategy.settings.profile.id];
|
|
17
|
+
if (!profileId) {
|
|
18
|
+
log.warn(JSON.stringify(jsonProfile));
|
|
19
|
+
return done(`OIDC user profile does not contain id property ${strategy.settings.profile.id}`);
|
|
20
|
+
}
|
|
21
|
+
User.getUserByAuthenticationStrategy(strategy.type, profileId, function (err, user) {
|
|
22
|
+
if (err)
|
|
23
|
+
return done(err);
|
|
24
|
+
if (!user) {
|
|
25
|
+
// Create an account for the user
|
|
26
|
+
Role.getRole('USER_ROLE', function (err, role) {
|
|
27
|
+
if (err)
|
|
28
|
+
return done(err);
|
|
29
|
+
const user = {
|
|
30
|
+
username: profileId,
|
|
31
|
+
displayName: jsonProfile[strategy.settings.profile.displayName] || profileId,
|
|
32
|
+
email: jsonProfile[strategy.settings.profile.email],
|
|
33
|
+
active: false,
|
|
34
|
+
roleId: role._id,
|
|
35
|
+
authentication: {
|
|
36
|
+
type: strategy.name,
|
|
37
|
+
id: profileId,
|
|
38
|
+
authenticationConfiguration: {
|
|
39
|
+
name: strategy.name
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
new api.User().create(user).then(newUser => {
|
|
44
|
+
if (!newUser.authentication.authenticationConfiguration.enabled) {
|
|
45
|
+
log.warn(newUser.authentication.authenticationConfiguration.title + " authentication is not enabled");
|
|
46
|
+
return done(null, false, { message: 'Authentication method is not enabled, please contact a MAGE administrator for assistance.' });
|
|
47
|
+
}
|
|
48
|
+
return done(null, newUser);
|
|
49
|
+
}).catch(err => done(err));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else if (!user.active) {
|
|
53
|
+
return done(null, user, { message: "User is not approved, please contact your MAGE administrator to approve your account." });
|
|
54
|
+
}
|
|
55
|
+
else if (!user.authentication.authenticationConfiguration.enabled) {
|
|
56
|
+
log.warn(user.authentication.authenticationConfiguration.title + " authentication is not enabled");
|
|
57
|
+
return done(null, user, { message: 'Authentication method is not enabled, please contact a MAGE administrator for assistance.' });
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return done(null, user);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
function authenticate(req, res, next) {
|
|
65
|
+
passport.authenticate(strategy.name, function (err, user, info = {}) {
|
|
66
|
+
if (err)
|
|
67
|
+
return next(err);
|
|
68
|
+
// TODO, this is a workaround for openidconnect library killing the app state
|
|
69
|
+
req.query.state = info.state;
|
|
70
|
+
req.user = user;
|
|
71
|
+
// For inactive or disabled accounts don't generate an authorization token
|
|
72
|
+
if (!user.active || !user.enabled) {
|
|
73
|
+
log.warn('Failed user login attempt: User ' + user.username + ' account is inactive or disabled.');
|
|
74
|
+
return next();
|
|
75
|
+
}
|
|
76
|
+
if (!user.authentication.authenticationConfigurationId) {
|
|
77
|
+
log.warn('Failed user login attempt: ' + user.authentication.type + ' is not configured');
|
|
78
|
+
return next();
|
|
79
|
+
}
|
|
80
|
+
if (!user.authentication.authenticationConfiguration.enabled) {
|
|
81
|
+
log.warn('Failed user login attempt: Authentication ' + user.authentication.authenticationConfiguration.title + ' is disabled.');
|
|
82
|
+
return next();
|
|
83
|
+
}
|
|
84
|
+
tokenService.generateToken(user._id.toString(), TokenAssertion.Authorized, 60 * 5)
|
|
85
|
+
.then(token => {
|
|
86
|
+
req.token = token;
|
|
87
|
+
req.user = user;
|
|
88
|
+
req.info = info;
|
|
89
|
+
next();
|
|
90
|
+
}).catch(err => {
|
|
91
|
+
next(err);
|
|
92
|
+
});
|
|
93
|
+
})(req, res, next);
|
|
94
|
+
}
|
|
95
|
+
app.get(`/auth/${strategy.name}/callback`, authenticate, function (req, res) {
|
|
96
|
+
if (req.query.state === 'mobile') {
|
|
97
|
+
let uri;
|
|
98
|
+
if (!req.user.active || !req.user.enabled) {
|
|
99
|
+
uri = `mage://app/invalid_account?active=${req.user.active}&enabled=${req.user.enabled}`;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
uri = `mage://app/authentication?token=${req.token}`;
|
|
103
|
+
}
|
|
104
|
+
res.redirect(uri);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
res.render('authentication', { host: req.getRoot(), login: { token: req.token, user: req.user } });
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function setDefaults(strategy) {
|
|
112
|
+
//openid must be included in scope
|
|
113
|
+
if (!strategy.settings.scope) {
|
|
114
|
+
strategy.settings.scope = ['openid'];
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
if (!strategy.settings.scope.includes('openid')) {
|
|
118
|
+
strategy.settings.scope.push('openid');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (!strategy.settings.profile) {
|
|
122
|
+
strategy.settings.profile = {};
|
|
123
|
+
}
|
|
124
|
+
if (!strategy.settings.profile.displayName) {
|
|
125
|
+
strategy.settings.profile.displayName = 'name';
|
|
126
|
+
}
|
|
127
|
+
if (!strategy.settings.profile.email) {
|
|
128
|
+
strategy.settings.profile.email = 'email';
|
|
129
|
+
}
|
|
130
|
+
if (!strategy.settings.profile.id) {
|
|
131
|
+
strategy.settings.profile.id = 'sub';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function initialize(strategy) {
|
|
135
|
+
configure(strategy);
|
|
136
|
+
setDefaults(strategy);
|
|
137
|
+
app.get(`/auth/${strategy.name}/signin`, function (req, res, next) {
|
|
138
|
+
passport.authenticate(strategy.name, {
|
|
139
|
+
scope: strategy.settings.scope,
|
|
140
|
+
state: req.query.state
|
|
141
|
+
})(req, res, next);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
;
|
|
145
|
+
module.exports = {
|
|
146
|
+
initialize
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=openidconnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openidconnect.js","sourceRoot":"","sources":["../../src/authentication/openidconnect.js"],"names":[],"mappings":";AAAA,MAAM,qBAAqB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EACpE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,EACxB,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAChC,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAChC,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,cAAc,EACzD,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,EACvB,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAEzD,SAAS,SAAS,CAAC,QAAQ;IACzB,GAAG,CAAC,IAAI,CAAC,eAAe,QAAQ,CAAC,KAAK,iBAAiB,CAAC,CAAC;IAEzD,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,qBAAqB,CAAC;QACpD,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ;QACpC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,YAAY;QAC5C,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;QAChC,gBAAgB,EAAE,QAAQ,CAAC,QAAQ,CAAC,gBAAgB;QACpD,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ;QACpC,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU;QACzC,WAAW,EAAE,SAAS,QAAQ,CAAC,IAAI,WAAW;QAC9C,KAAK,EAAE,QAAQ,CAAC,QAAQ,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],"mappings":"AAyNA,gDA2GC"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const SamlStrategy = require('passport-saml').Strategy, log = require('winston'), User = require('../models/user'), Role = require('../models/role'), Device = require('../models/device'), TokenAssertion = require('./verification').TokenAssertion, api = require('../api'), userTransformer = require('../transformers/user'), AuthenticationInitializer = require('./index'), authenticationApiAppender = require('../utilities/authenticationApiAppender');
|
|
3
|
+
function configure(strategy) {
|
|
4
|
+
log.info('Configuring ' + strategy.title + ' authentication');
|
|
5
|
+
const options = {
|
|
6
|
+
path: `/auth/${strategy.name}/callback`,
|
|
7
|
+
entryPoint: strategy.settings.options.entryPoint,
|
|
8
|
+
issuer: strategy.settings.options.issuer
|
|
9
|
+
};
|
|
10
|
+
if (strategy.settings.cert) {
|
|
11
|
+
options.cert = strategy.settings.cert;
|
|
12
|
+
}
|
|
13
|
+
if (strategy.settings.privateCert) {
|
|
14
|
+
options.privateCert = strategy.settings.privateCert;
|
|
15
|
+
}
|
|
16
|
+
if (strategy.settings.decryptionPvk) {
|
|
17
|
+
options.decryptionPvk = strategy.settings.decryptionPvk;
|
|
18
|
+
}
|
|
19
|
+
if (strategy.settings.signatureAlgorithm) {
|
|
20
|
+
options.signatureAlgorithm = strategy.settings.signatureAlgorithm;
|
|
21
|
+
}
|
|
22
|
+
if (strategy.settings.audience) {
|
|
23
|
+
options.audience = strategy.settings.audience;
|
|
24
|
+
}
|
|
25
|
+
if (strategy.settings.identifierFormat) {
|
|
26
|
+
options.identifierFormat = strategy.settings.identifierFormat;
|
|
27
|
+
}
|
|
28
|
+
if (strategy.settings.acceptedClockSkewMs) {
|
|
29
|
+
options.acceptedClockSkewMs = strategy.settings.acceptedClockSkewMs;
|
|
30
|
+
}
|
|
31
|
+
if (strategy.settings.attributeConsumingServiceIndex) {
|
|
32
|
+
options.attributeConsumingServiceIndex = strategy.settings.attributeConsumingServiceIndex;
|
|
33
|
+
}
|
|
34
|
+
if (strategy.settings.disableRequestedAuthnContext) {
|
|
35
|
+
options.disableRequestedAuthnContext = strategy.settings.disableRequestedAuthnContext;
|
|
36
|
+
}
|
|
37
|
+
if (strategy.settings.authnContext) {
|
|
38
|
+
options.authnContext = strategy.settings.authnContext;
|
|
39
|
+
}
|
|
40
|
+
if (strategy.settings.forceAuthn) {
|
|
41
|
+
options.forceAuthn = strategy.settings.forceAuthn;
|
|
42
|
+
}
|
|
43
|
+
if (strategy.settings.skipRequestCompression) {
|
|
44
|
+
options.skipRequestCompression = strategy.settings.skipRequestCompression;
|
|
45
|
+
}
|
|
46
|
+
if (strategy.settings.authnRequestBinding) {
|
|
47
|
+
options.authnRequestBinding = strategy.settings.authnRequestBinding;
|
|
48
|
+
}
|
|
49
|
+
if (strategy.settings.RACComparison) {
|
|
50
|
+
options.RACComparison = strategy.settings.RACComparison;
|
|
51
|
+
}
|
|
52
|
+
if (strategy.settings.providerName) {
|
|
53
|
+
options.providerName = strategy.settings.providerName;
|
|
54
|
+
}
|
|
55
|
+
if (strategy.settings.idpIssuer) {
|
|
56
|
+
options.idpIssuer = strategy.settings.idpIssuer;
|
|
57
|
+
}
|
|
58
|
+
if (strategy.settings.validateInResponseTo) {
|
|
59
|
+
options.validateInResponseTo = strategy.settings.validateInResponseTo;
|
|
60
|
+
}
|
|
61
|
+
if (strategy.settings.requestIdExpirationPeriodMs) {
|
|
62
|
+
options.requestIdExpirationPeriodMs = strategy.settings.requestIdExpirationPeriodMs;
|
|
63
|
+
}
|
|
64
|
+
if (strategy.settings.logoutUrl) {
|
|
65
|
+
options.logoutUrl = strategy.settings.logoutUrl;
|
|
66
|
+
}
|
|
67
|
+
AuthenticationInitializer.passport.use(new SamlStrategy(options, function (profile, done) {
|
|
68
|
+
const uid = profile[strategy.settings.profile.id];
|
|
69
|
+
if (!uid) {
|
|
70
|
+
log.warn('Failed to find property uid. SAML profile keys ' + Object.keys(profile));
|
|
71
|
+
return done('Failed to load user id from SAML profile');
|
|
72
|
+
}
|
|
73
|
+
User.getUserByAuthenticationStrategy(strategy.type, uid, function (err, user) {
|
|
74
|
+
if (err)
|
|
75
|
+
return done(err);
|
|
76
|
+
if (!user) {
|
|
77
|
+
// Create an account for the user
|
|
78
|
+
Role.getRole('USER_ROLE', function (err, role) {
|
|
79
|
+
if (err)
|
|
80
|
+
return done(err);
|
|
81
|
+
const user = {
|
|
82
|
+
username: uid,
|
|
83
|
+
displayName: profile[strategy.settings.profile.displayName],
|
|
84
|
+
email: profile[strategy.settings.profile.email],
|
|
85
|
+
active: false,
|
|
86
|
+
roleId: role._id,
|
|
87
|
+
authentication: {
|
|
88
|
+
type: strategy.name,
|
|
89
|
+
id: uid,
|
|
90
|
+
authenticationConfiguration: {
|
|
91
|
+
name: strategy.name
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
new api.User().create(user).then(newUser => {
|
|
96
|
+
if (!newUser.authentication.authenticationConfiguration.enabled) {
|
|
97
|
+
log.warn(newUser.authentication.authenticationConfiguration.title + " authentication is not enabled");
|
|
98
|
+
return done(null, false, { message: 'Authentication method is not enabled, please contact a MAGE administrator for assistance.' });
|
|
99
|
+
}
|
|
100
|
+
return done(null, newUser);
|
|
101
|
+
}).catch(err => done(err));
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else if (!user.active) {
|
|
105
|
+
return done(null, user, { message: "User is not approved, please contact your MAGE administrator to approve your account." });
|
|
106
|
+
}
|
|
107
|
+
else if (!user.authentication.authenticationConfiguration.enabled) {
|
|
108
|
+
log.warn(user.authentication.authenticationConfiguration.title + " authentication is not enabled");
|
|
109
|
+
return done(null, user, { message: 'Authentication method is not enabled, please contact a MAGE administrator for assistance.' });
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return done(null, user);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}));
|
|
116
|
+
function authenticate(req, res, next) {
|
|
117
|
+
AuthenticationInitializer.passport.authenticate(strategy.name, function (err, user, info = {}) {
|
|
118
|
+
if (err)
|
|
119
|
+
return next(err);
|
|
120
|
+
req.user = user;
|
|
121
|
+
// For inactive or disabled accounts don't generate an authorization token
|
|
122
|
+
if (!user.active || !user.enabled) {
|
|
123
|
+
log.warn('Failed user login attempt: User ' + user.username + ' account is inactive or disabled.');
|
|
124
|
+
return next();
|
|
125
|
+
}
|
|
126
|
+
if (!user.authentication.authenticationConfigurationId) {
|
|
127
|
+
log.warn('Failed user login attempt: ' + user.authentication.type + ' is not configured');
|
|
128
|
+
return next();
|
|
129
|
+
}
|
|
130
|
+
if (!user.authentication.authenticationConfiguration.enabled) {
|
|
131
|
+
log.warn('Failed user login attempt: Authentication ' + user.authentication.authenticationConfiguration.title + ' is disabled.');
|
|
132
|
+
return next();
|
|
133
|
+
}
|
|
134
|
+
// DEPRECATED session authorization, remove req.login which creates session in next version
|
|
135
|
+
req.login(user, function (err) {
|
|
136
|
+
AuthenticationInitializer.tokenService.generateToken(user._id.toString(), TokenAssertion.Authorized, 60 * 5)
|
|
137
|
+
.then(token => {
|
|
138
|
+
req.token = token;
|
|
139
|
+
req.user = user;
|
|
140
|
+
req.info = info;
|
|
141
|
+
next();
|
|
142
|
+
}).catch(err => {
|
|
143
|
+
next(err);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
})(req, res, next);
|
|
147
|
+
}
|
|
148
|
+
AuthenticationInitializer.app.post(`/auth/${strategy.name}/callback`, authenticate, function (req, res) {
|
|
149
|
+
let state = {};
|
|
150
|
+
try {
|
|
151
|
+
state = JSON.parse(req.body.RelayState);
|
|
152
|
+
}
|
|
153
|
+
catch (ignore) { }
|
|
154
|
+
if (state.initiator === 'mage') {
|
|
155
|
+
if (state.client === 'mobile') {
|
|
156
|
+
let uri;
|
|
157
|
+
if (!req.user.active || !req.user.enabled) {
|
|
158
|
+
uri = `mage://app/invalid_account?active=${req.user.active}&enabled=${req.user.enabled}`;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
uri = `mage://app/authentication?token=${req.token}`;
|
|
162
|
+
}
|
|
163
|
+
res.redirect(uri);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
res.render('authentication', { host: req.getRoot(), login: { token: req.token, user: req.user } });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
if (req.user.active && req.user.enabled) {
|
|
171
|
+
res.redirect(`/#/signin?strategy=${strategy.name}&action=authorize-device&token=${req.token}`);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const action = !req.user.active ? 'inactive-account' : 'disabled-account';
|
|
175
|
+
res.redirect(`/#/signin?strategy=${strategy.name}&action=${action}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function setDefaults(strategy) {
|
|
181
|
+
if (!strategy.settings.profile) {
|
|
182
|
+
strategy.settings.profile = {};
|
|
183
|
+
}
|
|
184
|
+
if (!strategy.settings.profile.displayName) {
|
|
185
|
+
strategy.settings.profile.displayName = 'email';
|
|
186
|
+
}
|
|
187
|
+
if (!strategy.settings.profile.email) {
|
|
188
|
+
strategy.settings.profile.email = 'email';
|
|
189
|
+
}
|
|
190
|
+
if (!strategy.settings.profile.id) {
|
|
191
|
+
strategy.settings.profile.id = 'uid';
|
|
192
|
+
}
|
|
193
|
+
if (!strategy.settings.options) {
|
|
194
|
+
strategy.settings.options = {};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function initialize(strategy) {
|
|
198
|
+
const app = AuthenticationInitializer.app;
|
|
199
|
+
const passport = AuthenticationInitializer.passport;
|
|
200
|
+
const provision = AuthenticationInitializer.provision;
|
|
201
|
+
setDefaults(strategy);
|
|
202
|
+
configure(strategy);
|
|
203
|
+
function parseLoginMetadata(req, res, next) {
|
|
204
|
+
req.loginOptions = {
|
|
205
|
+
userAgent: req.headers['user-agent'],
|
|
206
|
+
appVersion: req.param('appVersion')
|
|
207
|
+
};
|
|
208
|
+
next();
|
|
209
|
+
}
|
|
210
|
+
app.get('/auth/' + strategy.name + '/signin', function (req, res, next) {
|
|
211
|
+
const state = {
|
|
212
|
+
initiator: 'mage',
|
|
213
|
+
client: req.query.state
|
|
214
|
+
};
|
|
215
|
+
passport.authenticate(strategy.name, {
|
|
216
|
+
additionalParams: { RelayState: JSON.stringify(state) }
|
|
217
|
+
})(req, res, next);
|
|
218
|
+
});
|
|
219
|
+
// DEPRECATED retain old routes as deprecated until next major version.
|
|
220
|
+
// Create a new device
|
|
221
|
+
// Any authenticated user can create a new device, the registered field
|
|
222
|
+
// will be set to false.
|
|
223
|
+
app.post('/auth/' + strategy.name + '/devices', function (req, res, next) {
|
|
224
|
+
if (req.user) {
|
|
225
|
+
next();
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
res.sendStatus(401);
|
|
229
|
+
}
|
|
230
|
+
}, function (req, res, next) {
|
|
231
|
+
const newDevice = {
|
|
232
|
+
uid: req.param('uid'),
|
|
233
|
+
name: req.param('name'),
|
|
234
|
+
registered: false,
|
|
235
|
+
description: req.param('description'),
|
|
236
|
+
userAgent: req.headers['user-agent'],
|
|
237
|
+
appVersion: req.param('appVersion'),
|
|
238
|
+
userId: req.user.id
|
|
239
|
+
};
|
|
240
|
+
Device.getDeviceByUid(newDevice.uid)
|
|
241
|
+
.then(device => {
|
|
242
|
+
if (device) {
|
|
243
|
+
// already exists, do not register
|
|
244
|
+
return res.json(device);
|
|
245
|
+
}
|
|
246
|
+
Device.createDevice(newDevice)
|
|
247
|
+
.then(device => res.json(device))
|
|
248
|
+
.catch(err => next(err));
|
|
249
|
+
})
|
|
250
|
+
.catch(err => next(err));
|
|
251
|
+
});
|
|
252
|
+
// DEPRECATED session authorization, remove in next version.
|
|
253
|
+
app.post('/auth/' + strategy.name + '/authorize', function (req, res, next) {
|
|
254
|
+
if (req.user) {
|
|
255
|
+
log.warn('session authorization is deprecated, please use jwt');
|
|
256
|
+
return next();
|
|
257
|
+
}
|
|
258
|
+
passport.authenticate('authorization', function (err, user, info = {}) {
|
|
259
|
+
if (!user)
|
|
260
|
+
return res.status(401).send(info.message);
|
|
261
|
+
req.user = user;
|
|
262
|
+
next();
|
|
263
|
+
})(req, res, next);
|
|
264
|
+
}, provision.check(strategy.name), parseLoginMetadata, function (req, res, next) {
|
|
265
|
+
new api.User().login(req.user, req.provisionedDevice, req.loginOptions, function (err, token) {
|
|
266
|
+
if (err)
|
|
267
|
+
return next(err);
|
|
268
|
+
authenticationApiAppender.append(strategy.api).then(api => {
|
|
269
|
+
res.json({
|
|
270
|
+
token: token.token,
|
|
271
|
+
expirationDate: token.expirationDate,
|
|
272
|
+
user: userTransformer.transform(req.user, { path: req.getRoot() }),
|
|
273
|
+
device: req.provisionedDevice,
|
|
274
|
+
api: api
|
|
275
|
+
});
|
|
276
|
+
}).catch(err => {
|
|
277
|
+
next(err);
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
req.session = null;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
;
|
|
284
|
+
module.exports = {
|
|
285
|
+
initialize
|
|
286
|
+
};
|
|
287
|
+
//# sourceMappingURL=saml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saml.js","sourceRoot":"","sources":["../../src/authentication/saml.js"],"names":[],"mappings":";AAAA,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,EAClD,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,EACxB,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAChC,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAChC,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,EACpC,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,cAAc,EACzD,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,EACvB,eAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC,EACjD,yBAAyB,GAAG,OAAO,CAAC,SAAS,CAAC,EAC9C,yBAAy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C,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,CAAC,CACF,CAAC;AAEJ,CAAC;AAAA,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG;IACf,UAAU;CACX,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function payload(subject: any, assertion: any): {
|
|
2
|
+
subject: string;
|
|
3
|
+
assertion: any;
|
|
4
|
+
};
|
|
5
|
+
export namespace TokenAssertion {
|
|
6
|
+
const Authorized: string;
|
|
7
|
+
const Captcha: string;
|
|
8
|
+
}
|
|
9
|
+
export class TokenGenerateError extends Error {
|
|
10
|
+
constructor(subject: any, assertion: any, secondsToLive: any, cause: any);
|
|
11
|
+
subject: any;
|
|
12
|
+
assertion: any;
|
|
13
|
+
secondsToLive: any;
|
|
14
|
+
cause: any;
|
|
15
|
+
}
|
|
16
|
+
export namespace VerificationErrorReason {
|
|
17
|
+
const NoToken: string;
|
|
18
|
+
const Subject: string;
|
|
19
|
+
const Assertion: string;
|
|
20
|
+
const Expired: string;
|
|
21
|
+
const Decode: string;
|
|
22
|
+
const Implementation: string;
|
|
23
|
+
}
|
|
24
|
+
export const JWTService: {
|
|
25
|
+
new (secret: any, issuer: any): {
|
|
26
|
+
_secret: any;
|
|
27
|
+
_issuer: any;
|
|
28
|
+
_algorithm: string;
|
|
29
|
+
generateToken(subject: any, assertion: any, secondsToLive: any, claims?: {}): Promise<any>;
|
|
30
|
+
verifyToken(token: any, expected: any): Promise<any>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/authentication/verification.js"],"names":[],"mappings":"AAEA;;;EAEC;;;;;AAgBD;IAEE,0EAYC;IATC,aAAsB;IACtB,eAA0B;IAC1B,mBAAkC;IAClC,WAAkB;CAOrB;;;;;;;;;AAsCD;;;;;;;;EAwEC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const JWT = require('jsonwebtoken');
|
|
3
|
+
function payload(subject, assertion) {
|
|
4
|
+
return { subject: `${subject}`, assertion: assertion };
|
|
5
|
+
}
|
|
6
|
+
const VerificationErrorReason = {
|
|
7
|
+
NoToken: 'no_token',
|
|
8
|
+
Subject: 'subject',
|
|
9
|
+
Assertion: 'assertion',
|
|
10
|
+
Expired: 'expired',
|
|
11
|
+
Decode: 'decode',
|
|
12
|
+
Implementation: 'implementation'
|
|
13
|
+
};
|
|
14
|
+
const TokenAssertion = {
|
|
15
|
+
Authorized: 'urn:mage:auth:authorized',
|
|
16
|
+
Captcha: 'urn:mage:signup:captcha'
|
|
17
|
+
};
|
|
18
|
+
class TokenGenerateError extends Error {
|
|
19
|
+
constructor(subject, assertion, secondsToLive, cause) {
|
|
20
|
+
super();
|
|
21
|
+
this.name = 'TokenVerificationError';
|
|
22
|
+
this.subject = subject;
|
|
23
|
+
this.assertion = assertion;
|
|
24
|
+
this.secondsToLive = secondsToLive;
|
|
25
|
+
this.cause = cause;
|
|
26
|
+
let causeMessage = '';
|
|
27
|
+
if (cause) {
|
|
28
|
+
causeMessage = 'cause=' + (cause instanceof Error ? `${"\n" + cause.stack || `${cause.name}: ${cause.message}`}` : `${cause}`);
|
|
29
|
+
}
|
|
30
|
+
this.message = `error generating token: subject=${subject}; assertion=${assertion}; secondsToLive=${secondsToLive}; ${causeMessage}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
class TokenVerificationError extends Error {
|
|
34
|
+
/**
|
|
35
|
+
* @param reason why the verification failed
|
|
36
|
+
* @param subject the expected subject
|
|
37
|
+
* @param assertion the expected assertion
|
|
38
|
+
* @param token the encoded token string
|
|
39
|
+
* @param decoded the decoded payload of the token
|
|
40
|
+
* @param cause cause of the verification error from the underlying token implementation
|
|
41
|
+
*/
|
|
42
|
+
constructor(reason, expected, token, decoded, cause) {
|
|
43
|
+
super();
|
|
44
|
+
this.reason = reason;
|
|
45
|
+
this.expected = expected || { subject: null, assertion: null };
|
|
46
|
+
this.token = token;
|
|
47
|
+
this.decoded = decoded;
|
|
48
|
+
let reasonMessage = `${reason}`;
|
|
49
|
+
let causeMessage = '';
|
|
50
|
+
if (cause) {
|
|
51
|
+
causeMessage = 'cause=' + (cause instanceof Error ? `${"\n" + cause.stack || `${cause.name}: ${cause.message}`}` : `${cause}`);
|
|
52
|
+
}
|
|
53
|
+
decoded = decoded || { subject: null, assertion: null, expiration: null };
|
|
54
|
+
if (reason === VerificationErrorReason.Subject) {
|
|
55
|
+
reasonMessage = `subject was ${decoded.subject}`;
|
|
56
|
+
}
|
|
57
|
+
else if (reason === VerificationErrorReason.Assertion) {
|
|
58
|
+
reasonMessage = `assertion was ${decoded.assertion}`;
|
|
59
|
+
}
|
|
60
|
+
else if (reason === VerificationErrorReason.Expired) {
|
|
61
|
+
reasonMessage = `token expired ${new Date(decoded.expiration || 0)} (${decoded.expiration})`;
|
|
62
|
+
}
|
|
63
|
+
else if (reason === VerificationErrorReason.Decode) {
|
|
64
|
+
reasonMessage = `failed to decode token`;
|
|
65
|
+
}
|
|
66
|
+
this.message = `TokenVerificationError (${reasonMessage}): expected subject=${this.expected.subject}, assertion=${this.expected.assertion}; token=${token}; ${causeMessage}`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const JWTService = class {
|
|
70
|
+
constructor(secret, issuer) {
|
|
71
|
+
this._secret = secret;
|
|
72
|
+
this._issuer = issuer;
|
|
73
|
+
this._algorithm = 'HS256';
|
|
74
|
+
}
|
|
75
|
+
generateToken(subject, assertion, secondsToLive, claims = {}) {
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
77
|
+
const payload = Object.assign({ assertion: assertion }, claims);
|
|
78
|
+
JWT.sign(payload, this._secret, {
|
|
79
|
+
algorithm: this._algorithm,
|
|
80
|
+
issuer: this._issuer,
|
|
81
|
+
expiresIn: secondsToLive,
|
|
82
|
+
subject: subject,
|
|
83
|
+
}, (err, token) => {
|
|
84
|
+
if (err) {
|
|
85
|
+
reject(new TokenGenerateError(subject, assertion, secondsToLive, err));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
resolve(token);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
verifyToken(token, expected) {
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
95
|
+
JWT.verify(token, this._secret, { algorithms: [this._algorithm], issuer: this._issuer }, (err, payload) => {
|
|
96
|
+
if (!expected) {
|
|
97
|
+
expected = { subject: null, assertion: null };
|
|
98
|
+
}
|
|
99
|
+
if (err) {
|
|
100
|
+
let reason = VerificationErrorReason.Implementation;
|
|
101
|
+
let decoded = null;
|
|
102
|
+
try {
|
|
103
|
+
const jwt = JWT.decode(token, { json: true });
|
|
104
|
+
if (jwt) {
|
|
105
|
+
decoded = Object.assign({}, jwt, {
|
|
106
|
+
subject: jwt.sub || null,
|
|
107
|
+
assertion: jwt.assertion || null,
|
|
108
|
+
expiration: jwt.exp || null
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
reason = VerificationErrorReason.Decode;
|
|
114
|
+
}
|
|
115
|
+
if (!decoded) {
|
|
116
|
+
reason = VerificationErrorReason.Decode;
|
|
117
|
+
decoded = { subject: null, assertion: null, expiration: null };
|
|
118
|
+
}
|
|
119
|
+
else if (err instanceof JWT.TokenExpiredError) {
|
|
120
|
+
reason = VerificationErrorReason.Expired;
|
|
121
|
+
}
|
|
122
|
+
return reject(new TokenVerificationError(reason, expected, token, payload, err));
|
|
123
|
+
}
|
|
124
|
+
else if (expected.subject && payload.sub !== expected.subject) {
|
|
125
|
+
return reject(new TokenVerificationError(VerificationErrorReason.Subject, expected, token, payload));
|
|
126
|
+
}
|
|
127
|
+
else if (expected.assertion && payload.assertion !== expected.assertion) {
|
|
128
|
+
return reject(new TokenVerificationError(VerificationErrorReason.Assertion, expected, token, payload));
|
|
129
|
+
}
|
|
130
|
+
resolve(Object.assign({}, payload, {
|
|
131
|
+
subject: payload.sub || null,
|
|
132
|
+
assertion: payload.assertion || null,
|
|
133
|
+
expiration: payload.exp || null
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports.payload = payload;
|
|
140
|
+
exports.TokenAssertion = TokenAssertion;
|
|
141
|
+
exports.TokenGenerateError = TokenGenerateError;
|
|
142
|
+
exports.VerificationErrorReason = VerificationErrorReason;
|
|
143
|
+
exports.JWTService = JWTService;
|
|
144
|
+
//# sourceMappingURL=verification.js.map
|