aertslab / SCope

Fast visualization tool for large-scale and high dimensional single-cell data
GNU General Public License v3.0
69 stars 14 forks source link

Proper OpenID Connect auth implementation #488

Closed MaybeJustJames closed 2 years ago

MaybeJustJames commented 2 years ago

This PR fleshes out an authentication/authorization mechanism using OpenID Connect Authorization Code Flow.

Further it begins to flesh out a deployment process by adding an administration command: poetry run scope-console. Using this command an administrator can customize authentication providers, administrator user setup, and file upload limits. A local OpenID Connect provider (KeyCloak) is used for local development using docker.

Closes #322, #253

To explore the API:

cd SCope/
docker-compose up -d && sleep 20 # The Keycloak server takes a while to start up
cd server/
./run-dev-env.sh

Then open a browser and point it to http://localhost:8000/api/v1/docs, or open Postman and import the project.

In order to get an access token:

  1. Query the /auth/loginurl endpoint and copy the response URL into a browser
  2. When prompted username is "scope" and password is "scope" SCope login
  3. From the redirect URL, copy the code parameter into the code field in the body of the /auth/authorize endpoint (The state field should already be filled properly if you're using Postman). Copy code parameter
  4. If you're using Postman to explore the API, the access token is automatically used by the other endpoints so you no longer need to worry about it.