feat: CLI authentication — login, token storage, auto-refresh
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- go
- 領域
- api, authentication, cli
調査の方向性
Start by reviewing the previous auth/oidc package referenced in salt evolution PR #85 and the integration points in salt/cli. Define how LoginCmd, LogoutCmd, Token, Client, secure token storage, refresh, and the PKCE flow fit together. Done means the five listed components are implemented as a usable CLI authentication package.
索引モデルが issue の本文から書いたものです。
説明
Context
The current auth/oidc package provides only the OIDC/PKCE browser flow for token acquisition. It's incomplete — no token storage, no refresh, no HTTP client integration. No raystack project uses it.
Meanwhile, every raystack CLI (frontier, compass, guardian) connects to APIs without authentication, which only works in development/trusted environments. Production APIs require auth, and CLIs have no way to authenticate.
Proposed solution
A complete CLI auth package following the pattern of gh auth login, gcloud auth login, and terraform login:
// Login — opens browser, does OIDC, stores token
auth.Login(ctx, auth.Config{
Issuer: "https://accounts.google.com",
ClientID: "...",
RedirectURL: "http://localhost:5454",
})
// Token — reads stored token, refreshes if expired
token, err := auth.Token(ctx)
// Client — returns http.Client that auto-attaches the token
client := auth.Client(ctx)
Components
- Token acquisition — browser-based OIDC with PKCE (existing code from dropped
auth/oidc) - Token storage — secure local storage at
~/.config/raystack/<app>/token.json - Token refresh — auto-refresh expired tokens using refresh_token
- HTTP client —
http.RoundTripperthat reads stored token and attaches to requests - CLI commands —
LoginCmd()andLogoutCmd()for easy integration withcli.Execute()
Integration with salt/cli
cli.Execute(
cli.Name("frontier"),
cli.Commands(
auth.LoginCmd(authConfig),
auth.LogoutCmd(),
userCmd, groupCmd,
),
)
// In commands:
func newListCmd() *cobra.Command {
return &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
client := auth.Client(cmd)
// make authenticated API calls
},
}
}
References
- GitHub CLI auth: https://github.com/cli/cli/tree/trunk/internal/authflow
- Previous
auth/oidcpackage (dropped in salt evolution PR #85) had the PKCE flow
- 主要言語
- Go
- スター
- 14
- フォーク
- 8
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
raystack/salt のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Bob Shell support オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
santhosh-tekuri/jsonschema#276 ·