mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +08:00
feat: add all remaining Goth providers to Casdoor OAuth login (#1484)
* feat: add Amazon support as OAuth 3rd-party login * refactor: comebine the same URLs * refactor: use hyper component to create login button * feat: add all remaining Goth providers to Casdoor OAuth login * refactor: remove redundant props * fix: check provider auth url and params
This commit is contained in:
@ -174,13 +174,36 @@ func (c *ApiController) GetApplicationLogin() {
|
||||
}
|
||||
|
||||
func setHttpClient(idProvider idp.IdProvider, providerType string) {
|
||||
if providerType == "GitHub" || providerType == "Google" || providerType == "Facebook" || providerType == "LinkedIn" || providerType == "Steam" || providerType == "Line" {
|
||||
if isProxyProviderType(providerType) {
|
||||
idProvider.SetHttpClient(proxy.ProxyHttpClient)
|
||||
} else {
|
||||
idProvider.SetHttpClient(proxy.DefaultHttpClient)
|
||||
}
|
||||
}
|
||||
|
||||
func isProxyProviderType(providerType string) bool {
|
||||
providerTypes := []string{
|
||||
"GitHub",
|
||||
"Google",
|
||||
"Facebook",
|
||||
"LinkedIn",
|
||||
"Steam",
|
||||
"Line",
|
||||
"Amazon",
|
||||
"Instagram",
|
||||
"TikTok",
|
||||
"Twitter",
|
||||
"Uber",
|
||||
"Yahoo",
|
||||
}
|
||||
for _, v := range providerTypes {
|
||||
if strings.EqualFold(v, providerType) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Login ...
|
||||
// @Title Login
|
||||
// @Tag Login API
|
||||
|
Reference in New Issue
Block a user