akhenry / openmct-yamcs

Open MCT YAMCS plugin
14 stars 9 forks source link

How to add support for YAMCS token authentication ? #385

Open bangpradyumna opened 11 months ago

bangpradyumna commented 11 months ago

Hello, Thank you so much for developing this plugin! I've set it up and it works for a basic YAMCS instance whose APIs arent protected by token based authentication.

However, I now need to add support for it so that the plugin takes the username and password as part of its config and then gets the bearer token (which is refreshed every 15 mins). This bearer token should be part of every API/Websocket call.

One straightforward approach is to create a tokenManager in utils.js which stores and manages these tokens and then in every fetch() function call, insert the token from this tokenManager. Is there a better way to do this ?

I would really appreciate any help, Thanks alot!

unlikelyzero commented 7 months ago

@bangpradyumna we don't have experience with this pattern. I would consider doing all authentication / authorization on your proxy server and then pass that as a role for yamcs to manage

akhenry commented 5 months ago

@bangpradyumna We would love to support token based authentication for Yamcs. None of our current missions use it because we use institutional authentication mechanisms that are outside of Yamcs itself, so we don't have plans to implement this right now.

We would definitely consider a PR that implements this though, I'm sure a lot of folks would find this useful!