vaizard / glued-archived

1 stars 3 forks source link

Integrations #46

Open killua-eu opened 6 years ago

killua-eu commented 6 years ago

We want to support various integrations / apis / etc. so that Glued seamlessly includes and extends other tools. A sample integration will use the wekan API, will be the first supported integration.

t_users_integrations table

How to encrypt data:

The general schema would look like this:

{ "data": { "_v": "1", "action1": [{ "some-data1": "value1a", "some-data2": "value2a", "ts_created": 1508068091, "ts_updated": 1508068091 }, { "some-data1": "value1b", "some-data2": "value2b", "ts_created": 1499999999, "ts_updated": 1500000331 } ], "action2": [{ "some-other-data": "ovalue" }] } }

using the wekan integration as an example, we have only a single action requiring stored data (authenticating into wekan). So assuming that a user wants to integrate two different wekan instances, his/her decrypted wekan data block would look like this:

{ "data": { "_v": "1", "auth": [{ "uri": "https://wekan.example.com", "user": "loginname", "pass": "passwordname", "ts_created": 1508068091, "ts_updated": 1508068091 }, { "uri": "https://otherwekan.io", "user": "loginname2", "pass": "passwordname2", "ts_created": 1508068091, "ts_updated": 1508068091 }] } }

This must be obviously secured. As we need the passwords, hashing is not possible, hence encryption/decryption.

Once all this is done, we need a wekan module. That will at first show only "Wekan Integration" [ add new ]. The add new will show a hidden form generated from the json schema defining the wekan data above, user will submit his uri, user and pass - a test will be done:

curl https://wekan-website/users/login -d "username=login&password=pwd"

should return

{"id":"fkkrkfk3k3k3kd","token":"mr4nrjn4rk34ok4mfoKM@JKje4k22jkjdjdskjdskjd","tokenExpires":"2018-02-22T22:22:22.123Z"}

(we should be probably be storing the token here, so the above json may be just a plain security nightmare). Do some test stuff according to