feat: 统一 Commilitia Drop 全客户端命名与分发
This commit is contained in:
@@ -8,13 +8,15 @@ import AppKit
|
||||
#endif
|
||||
|
||||
// 应用内 Broker 登录(device-authorization + PKCE,对齐桌面 desktop/platform/oauth.go)。iOS 无法
|
||||
// 跑 loopback 监听,故用 ASWebAuthenticationSession + 自定义 scheme 回调(cdrop://auth-callback):
|
||||
// 1. GET {broker}/device/authorize?app=cdrop&redirect_uri=cdrop://auth-callback&state&code_challenge&S256
|
||||
// 2. 用户在 broker SSO 授权 → 回调 cdrop://auth-callback?code=..&state=..
|
||||
// 跑 loopback 监听,故用 ASWebAuthenticationSession + 自定义 scheme 回调
|
||||
// (commilitia-drop://auth-callback):
|
||||
// 1. GET {broker}/device/authorize?app=commilitia-drop&redirect_uri=commilitia-drop://auth-callback&...
|
||||
// 2. 用户在 broker SSO 授权 → 回调 commilitia-drop://auth-callback?code=..&state=..
|
||||
// 3. POST {broker}/device/token {code, code_verifier, redirect_uri} → bootstrap 机器令牌
|
||||
// 4. POST {api}/api/auth/device-session(Bearer bootstrap)→ cdrop 设备会话(带真名 / device_id)
|
||||
// 这样手机上直接输账号登录,无需另一台设备扫码批准。
|
||||
// 前置:broker 须为 cdrop 应用注册 redirect_uri cdrop://auth-callback(同桌面 loopback 须注册)。
|
||||
// 前置:broker 须为 Commilitia Drop 应用注册 redirect_uri
|
||||
// commilitia-drop://auth-callback(同桌面 loopback 须注册)。
|
||||
|
||||
enum BrokerLoginError: Error
|
||||
{
|
||||
@@ -35,7 +37,8 @@ final class BrokerAuthFlow: NSObject, ASWebAuthenticationPresentationContextProv
|
||||
{
|
||||
private var session: ASWebAuthenticationSession?
|
||||
|
||||
// 打开授权页,等回调 URL(cdrop://auth-callback?code=..&state=..)。用户取消 / 失败抛错。
|
||||
// 打开授权页,等回调 URL(commilitia-drop://auth-callback?code=..&state=..)。
|
||||
// 用户取消 / 失败抛错。
|
||||
func run(url: URL, callbackScheme: String) async throws -> URL
|
||||
{
|
||||
try await withCheckedThrowingContinuation
|
||||
|
||||
Reference in New Issue
Block a user