Refactor CLI login process

オープン
#1,381 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
api, cli

調査の方向性

まず、cli、client、rest モジュールにわたって login サブコマンドと関連メソッドを追跡し、各 SessionManager の生成と oidc_config の検索をたどります。設定からトークンパスがどのように読み取られるか、また rest クライアントが OIDC 設定をどのように取得するかを確認します。提案されたログインフローが統合され、トークンパスにクライアント設定が不要になるか CLI オプションとして公開され、interactive_login() と check_login() が記載されたケースをカバーすれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Python
スター
14
フォーク
14
平均マージ
2日 23時間
マージ済み PR(30日)
27

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DiamondLightSource/blueapi のほかの issue

DiamondLightSource/blueapi の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。