mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-05-07 04:16:12 +08:00
# Conflicts: # README.md # README_CN.md # README_JA.md # cmd/server/main.go # config.example.yaml # internal/api/handlers/management/auth_files.go # internal/api/server.go # internal/auth/iflow/iflow_auth.go # internal/cmd/auth_manager.go # internal/config/config.go # sdk/cliproxy/auth/oauth_model_alias.go # sdk/cliproxy/auth/types.go # test/thinking_conversion_test.go
35 lines
1.4 KiB
Go
35 lines
1.4 KiB
Go
package auth
|
|
|
|
import (
|
|
"time"
|
|
|
|
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth"
|
|
)
|
|
|
|
func init() {
|
|
registerRefreshLead("codex", func() Authenticator { return NewCodexAuthenticator() })
|
|
registerRefreshLead("claude", func() Authenticator { return NewClaudeAuthenticator() })
|
|
registerRefreshLead("gemini", func() Authenticator { return NewGeminiAuthenticator() })
|
|
registerRefreshLead("gemini-cli", func() Authenticator { return NewGeminiAuthenticator() })
|
|
registerRefreshLead("antigravity", func() Authenticator { return NewAntigravityAuthenticator() })
|
|
registerRefreshLead("kimi", func() Authenticator { return NewKimiAuthenticator() })
|
|
registerRefreshLead("kiro", func() Authenticator { return NewKiroAuthenticator() })
|
|
registerRefreshLead("github-copilot", func() Authenticator { return NewGitHubCopilotAuthenticator() })
|
|
registerRefreshLead("gitlab", func() Authenticator { return NewGitLabAuthenticator() })
|
|
registerRefreshLead("codebuddy", func() Authenticator { return NewCodeBuddyAuthenticator() })
|
|
registerRefreshLead("cursor", func() Authenticator { return NewCursorAuthenticator() })
|
|
}
|
|
|
|
func registerRefreshLead(provider string, factory func() Authenticator) {
|
|
cliproxyauth.RegisterRefreshLeadProvider(provider, func() *time.Duration {
|
|
if factory == nil {
|
|
return nil
|
|
}
|
|
auth := factory()
|
|
if auth == nil {
|
|
return nil
|
|
}
|
|
return auth.RefreshLead()
|
|
})
|
|
}
|