0.6.72 • Published 8 months ago

ts3d.hc.caas.usermanagement v0.6.72

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

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 guido@techsoft3d.com 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. 1. Clone the repository 2. Install all dependencies with npm install 3. Ensure CaaS is running on port 3001. If not, follow the instructions here 4. Start the server with npm start 5. Open a browser and navigate to http://localhost:3000 6. 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. 1. Install the module with npm install ts3d.hc.caas.usermanagement 2. Import the module with const caasUserManagementServer = require('ts3d.hc.caas.usermanagement'); 3. 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": ""
  }
}
  1. 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

  1. 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>
  2. Create a new CaasUserManagementClient object, specifying your server address.
    myUserManagmentClient = new CaasU.CaasUserManagementClient("http://localhost:3000");
  3. 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
      }
}
0.6.65

8 months ago

0.6.64

8 months ago

0.5.11

10 months ago

0.6.67

8 months ago

0.6.66

8 months ago

0.6.61

8 months ago

0.4.9

11 months ago

0.6.60

8 months ago

0.4.8

11 months ago

0.6.63

8 months ago

0.6.62

8 months ago

0.5.18

10 months ago

0.5.19

10 months ago

0.5.16

10 months ago

0.5.17

10 months ago

0.6.69

8 months ago

0.5.14

10 months ago

0.6.68

8 months ago

0.5.15

10 months ago

0.5.12

10 months ago

0.5.13

10 months ago

0.6.54

8 months ago

0.6.53

8 months ago

0.6.56

8 months ago

0.6.55

8 months ago

0.6.50

9 months ago

0.6.52

9 months ago

0.6.51

9 months ago

0.6.58

8 months ago

0.6.57

8 months ago

0.6.59

8 months ago

0.6.43

9 months ago

0.6.42

9 months ago

0.6.45

9 months ago

0.6.44

9 months ago

0.5.8

10 months ago

0.5.7

10 months ago

0.6.41

9 months ago

0.6.40

9 months ago

0.5.9

10 months ago

0.6.47

9 months ago

0.6.46

9 months ago

0.6.49

9 months ago

0.6.48

9 months ago

0.6.32

9 months ago

0.6.31

9 months ago

0.6.34

9 months ago

0.6.33

9 months ago

0.6.30

9 months ago

0.6.39

9 months ago

0.6.36

9 months ago

0.6.35

9 months ago

0.6.38

9 months ago

0.6.37

9 months ago

0.4.5

11 months ago

0.4.4

11 months ago

0.4.7

11 months ago

0.4.6

11 months ago

0.4.1

11 months ago

0.4.0

11 months ago

0.4.3

11 months ago

0.4.2

11 months ago

0.6.21

9 months ago

0.6.20

9 months ago

0.6.23

9 months ago

0.6.22

9 months ago

0.6.7

10 months ago

0.6.6

10 months ago

0.6.9

10 months ago

0.6.8

10 months ago

0.6.29

9 months ago

0.6.28

9 months ago

0.6.25

9 months ago

0.6.24

9 months ago

0.6.26

9 months ago

0.6.10

10 months ago

0.6.12

10 months ago

0.6.11

10 months ago

0.6.18

10 months ago

0.6.17

10 months ago

0.6.19

10 months ago

0.6.14

10 months ago

0.6.13

10 months ago

0.6.16

10 months ago

0.6.15

10 months ago

0.5.4

10 months ago

0.5.6

10 months ago

0.5.5

10 months ago

0.5.0

11 months ago

0.3.9

11 months ago

0.3.12

11 months ago

0.3.11

11 months ago

0.3.10

11 months ago

0.6.72

8 months ago

0.6.71

8 months ago

0.6.3

10 months ago

0.6.2

10 months ago

0.6.70

8 months ago

0.6.5

10 months ago

0.6.4

10 months ago

0.6.1

10 months ago

0.6.0

10 months ago

0.3.8

1 year ago

0.3.7

1 year ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.0

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago