spacecloud-io / space-cloud

Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes
https://space-cloud.io
Apache License 2.0
3.94k stars 222 forks source link

[Feature] Add support for admin login in SC #1686

Closed YourTechBud closed 1 year ago

YourTechBud commented 1 year ago

Create a backend api for user to login into SpaceCloud.

API for login

API: Post : /sc/v1/login Payload:

{"username": "", "password": "<in clear text>"}

Response Payload

{"token": "<jwt token (hsa algo>"}

JWT Payload:

{"sub": "<username>", "exp": "<2hr>"}

We will consider changing password hashing in the near future.

API for Refreshing token (For the UI)

API: Post : /sc/v1/refresh-token Payload: NO Request Body

Response Payload

{"token": "<jwt token (hsa algo>"}

Assumptions:

Create spacectl login command:

Attempts to login into SC to verify username and password and stores the same in a config file.

Behaiviour:

Note: All spacectl command outputs should use this library: https://github.com/pterm/pterm

If you want this feature to be implemented, give it a thumbs up reaction, so that we can determine which features are important to you. 👍