ts3d.hc.caas.usermanagement
v0.6.72
Published
* Various improvements and bugfixes * Requires CaaS version 0.11.89 or later
Downloads
26
Readme
CaaS User Management (beta)
Version (0.6.68)
- Various improvements and bugfixes
- Requires CaaS version 0.11.89 or later
Version (0.6.50)
- Version update for CaaS Server Depolyment Release
- Various improvements and bugfixes
- Requires CaaS version 0.9.5 or later
Version Update (0.3.8)
- Direct S3 Upload Support (single file and zip upload only)
- Requires CaaS Version 0.9.12 or later
Version Update (0.3.6)
- Direct S3 Upload Support (single file upload only)
Version Update (0.3.0)
- ZIP File Support in UI
Version Update (0.2.7)
- Support for multi-file upload for assemblies
- Upload UI redone
Introduction
This library implements user management on top of the CaaS library, which is a conversion and streaming backend for HOOPS Communicator. It provides a straightforward REST API for managing user accounts and their associated data, including Hubs and Projects with different access levels per user. By connecting this library to CaaS, you essentially get the framework for a CAD oriented SaaS application "out of the box", with a few lines of server-side code, ideal for prototyping and testing or as the starting point for your own development.
The library consists of three components, the server-side node.js library you can add to your project via npm as well as a client-side library for communicating with the server. It also comes with an easily extendable bootstrap based front-end that uses the client-side library.
Feedback
For questions/feedback please send an email to [email protected] or post in our forum. For a 60 day trial of the HOOPS Web Platform go to https://www.techsoft3d.com/products/hoops/web-platform.
Roadmap
- Assembly Upload Support for direct S3 upload
- Email Flow for Signup
- Oauth2 Support
- More modular UI Design
Documentation
Live Documentation for the client-side library can be found here: https://techsoft3d.github.io/hc-caas-usermanagement/
Disclaimer
This library is not an officially supported part of HOOPS Communicator and provided as-is.
Quick Start
To quickly test out CaaS User Management with the provided UI, follow the steps below.
- Clone the repository
- Install all dependencies with
npm install
- Ensure CaaS is running on port 3001. If not, follow the instructions here
- Start the server with
npm start
- Open a browser and navigate to
http://localhost:3000
- Register at least one user account, create a hub, project. You can then convert and view files, etc.
Integrate with your own Node-Based Application
Server Side
To integrate CaaS User Management into your own server application as a node module, follow the steps below.
- Install the module with
npm install ts3d.hc.caas.usermanagement
- Import the module with
const caasUserManagementServer = require('ts3d.hc.caas.usermanagement');
- If you want to override any of the default settings, create a config directory and an empty file called local.json and specifiy any setting you want to override. Here are the default settings:
{
"hc-caas-um": {
"mongodbURI": "mongodb://127.0.0.1:27017/caas_demo_app",
"conversionServiceURI": "http://localhost:3001",
"publicURL": "http://localhost:3000",
"useDirectFetch": false,
"useStreaming": false,
"demoMode": false,
"assignDemoHub": false,
"demoProject": ""
}
}
- Start the CaasUserManagementServer with caasUserManagementServer.start(), providing your express app as a parameter as well as other configuration settings. See below for a minimal example:
const express = require('express');
const path = require('path');
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
const caasUserManagementServer = require('ts3d.hc.caas.usermanagement');
caasUserManagementServer.start(app, null,{createSession:true, sessionSecret:"12345"});
app.listen(3000);
Client Side
- Add 'caasu.min.js' to your client-side project. The client-side library is included in the
/dist
folder of this repository.<script type="text/javascript" src="js/caasu.min.js"></script>
- Create a new CaasUserManagementClient object, specifying your server address.
myUserManagmentClient = new CaasU.CaasUserManagementClient("http://localhost:3000");
- See the frontend code in the public folder of this project and the reference manual for further API usage. Alternatively, feel free to copy the content of the public folder from this repository to your own project and use the provided reference implementation as a starting point for your own application.
Frontend
The frontend is a straightforward bootstrap based implementation that uses the client-side library to communicate with the server. The emphasis is on simplicity, the goal during development was to make it easy to understand and extend, not to provide a fully production ready implementation.
Additional Details on the Server
By default the CaaS User Management server will add its own REST end-points to your express app, which are all prefixed with /caas_um_api
. It will also start its own database session as well as create a user-session for cookie management. If you are already using mongoose as your database you can provide its connection as the second parameter to the start function. In addition, the User Management Server can create its own session store for cookie based session management but you can choose to provide your own as well. In this case the user management library will expect a session to be present on the request object for all its REST API calls. If you allow the User Management server to create its own session store, you should provide an "unguessable" sessionSecret
string for the session store, which will be used to sign the session cookies.
Security and User Accounts
Account management is provided out of the box, with a simple registration and login process, utilizing a straightforward encrypted password scheme. However it is easy to use the library with your own account management. To allow for this, the server-side library has a function to retrieve all user account data, which gives you the ability to create and query accounts directly server-side via mongoose, thereyby bypassing the REST API. This approach allows you to handle all account creation while still leveraging the library for managing the connection to CaaS as well as Hubs and Project. See below for an example on how to retrieve all user account data and add the user to the session object:
app.put('/myLogin', async function (req, res, next) {
//perform custom login procedure
//...
let usersDB = caasUserManagementServer.getDatabaseObjects().users;
let user = await usersDB.findOne({email:loggedinuser});
req.session.caasUser = users2;
});
If you use this approach, it is advisable to do additional authentication on the REST API calls to the User Management server to prevent unauthorized access to the user data and login endpoints.
Running CaaS User Management on a separate server
If you want to use the User Management node module on a separate server from your main application, you can do so by simply proxying its REST API calls (which are all prefixed with /caas_um_api
) from your web-server. In this scenario you might want to add an extra layer to the server to handle authentication and authorization if desired.
Running CaaS and CaaS User Management from the same project
You can easily run both CaaS and the CaaS User Management together. See below for a minimal example that initializes both libraries fromt the same Node application:
const express = require('express');
const path = require('path');
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
const conversionserver = require('ts3d.hc.caas');
conversionserver.start();
const caasUserManagementServer = require('ts3d.hc.caas.usermanagement');
caasUserManagementServer.start(app, null,{createSession:true, sessionSecret:"12345"});
app.listen(3000);
In this case, you want to make sure to have a local.json file in the config folder of your application which configures the two libraries following the pattern in the example below:
{
"hc-caas-um": {
//local settings for CaaS User Management
},
"hc-caas": {
//local settings for CaaS
}
}