VILLASframework / web

The VILLASweb frontend (website) for planning, controlling, monitoring and analysing distributed simulations.
https://fein-aachen.org/en/projects/villas-web/
GNU General Public License v3.0
3 stars 3 forks source link

Add new IC page for MIOB's (category=manager,type=miob) #305

Open stv0g opened 2 years ago

stv0g commented 2 years ago

As discussed in our earlier meetings, we would like to use the VILLASweb IC page for the touch panel displays of our Multi-IO Boxes (miob's).

I have implemented a new manager component for the MIOBs in VILLAScontroller (https://git.rwth-aachen.de/acs/public/villas/controller/-/merge_requests/30).

There is now also a MIOB already reporting its status to the Demo instance: https://villas.k8s.eonerc.rwth-aachen.de/infrastructure/547646

We can now customize the IC page for the additional status fields.

/cc @n-eiling

stv0g commented 2 years ago

In GitLab by @iripiri on Mar 30, 2022, 09:19

stv0g commented 2 years ago

In GitLab by @n-eiling on Mar 30, 2022, 09:35

This is how we start chromium: (Window Size 800x400)

/usr/bin/chromium-browser --window-size=800,480 --kiosk --window-position=0,0 http://127.0.0.1
stv0g commented 2 years ago

In GitLab by @n-eiling on Apr 6, 2022, 11:05

Another requirement for using VILLASweb on the MIOBs is that we have a way to login without user interaction - ideally just by visiting an URL as in my last comment. Maybe we can add a token that can be passed via GET request. (Should this be a separate issue?)

Related InFIS issue: https://git-ce.rwth-aachen.de/acs/private/research/infis/ap3/integration/-/issues/36

stv0g commented 2 years ago

In GitLab by @skolen on Apr 6, 2022, 11:41

You will need to request a token using the VILLASweb API endpoint.

.../authenticate/internal/ with a POST request including username and password in the body of the request. Tokens have a limited time validity so hard-coding a token in a subsequent request will not work permanently. We will have to create a user in VILLASweb for the MIOBs for this purpose.

To access the IC data of the MIOB you can pass the user token as a parameter in the query like this somehow:

.../ic/<id of component>?token=<my-awesome-token>

We could add another parameter here to automatically allow for toggling a full-screen mode of the IC page in the frontend once this feature is implemented.

Will need to find a way to store the user token in the browser storage so that the VILLASweb GUI knows about the successful authentication.

stv0g commented 2 years ago

In GitLab by @n-eiling on Apr 6, 2022, 12:00

Hm, I think it's really difficult / a lot of work to implement something where we maintain and update session tokens. I guess it would be possible to curl a HTTP POST request to get the token and use that in a GET request with chromium. However, the tokens should probably not be valid indefinitely and updating them might require quite some logic on the MIOB side.

To be honest, I would have just gone the route of punching holes in the whole security concept and allow certain tokens indefinite access without any previous login. Or open only the specific overview page to unauthorized access. Or somehow whitelist the MIOBs. They will probably communicate via VPN anyway, so security is not strictly necessary.

stv0g commented 2 years ago

Fetching a token via CURL is really easy:

TOKEN=$(curl -XPOST -d '{"Username": "test", "Password": "testtest"}' https://villas.k8s.eonerc.rwth-aachen.de/api/v2/authenticate/internal | jq -r .token)