Refactor CLI login process

Aperta
#1,381 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api, cli

Direzione di ricerca

Inizia tracciando il sottocomando login e i metodi di supporto nei moduli cli, client e rest, seguendo ogni creazione di SessionManager e la ricerca di oidc_config. Esamina come viene letto il percorso del token dalla configurazione e come il client rest ottiene la configurazione OIDC. Il lavoro è completato quando il flusso di login proposto è consolidato, il percorso del token non richiede più la configurazione del client oppure è esposto come opzione CLI, e interactive_login() e check_login() coprono i casi indicati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

auth c: cli c: client

The login subcommand and the supporting methods are spread across three modules (cli, client and rest). The configuration for them is split between the server (for the oidc config) and the config file (which we want the client to avoid needing (#1327)).

  • To login, a SessionManager is created using a path from the config and queried for a token
  • If it does not find a valid token, a client is created from the config (creating a new session manager from the same path)
  • The client is used to get the oidc_config (via the rest client)
  • The oidc config is used to create a third SessionManager
  • The final SessionManager is used to start the device flow and cache the token

Without having fully worked through the repercussions, it would be good to:

  • Remove the token file path from the config - we don't want to need a config file for the client
    • Make the token path a CLI option if it still needs to be configurable
  • Move the login method into the rest client - if we need the rest client to access the oidc config anyway, it makes sense to use it to log in.
    • interactive_login() - to prompt the user to login
    • check_login() - to fail early for scripts
Lingua principale
Python
Stelle
14
Fork
14
Merge medio
2g 23h
PR unite (30g)
27

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DiamondLightSource/blueapi

Tutte le issue di DiamondLightSource/blueapi

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.