feat: add three idp support by goth. (#351)

1. add 3 providers: apple, azuread(v1) and slack.
2. support importing providers from goth.

Signed-off-by: 0x2a <stevesough@gmail.com>
This commit is contained in:
Steve0x2a
2021-12-10 00:55:27 +08:00
committed by GitHub
parent b73b9a65b6
commit 967113689d
11 changed files with 436 additions and 2 deletions

View File

@ -16,6 +16,7 @@ package idp
import (
"net/http"
"strings"
"golang.org/x/oauth2"
)
@ -59,7 +60,20 @@ func GetIdProvider(providerType string, clientId string, clientSecret string, re
return NewLarkIdProvider(clientId, clientSecret, redirectUrl)
} else if providerType == "GitLab" {
return NewGitlabIdProvider(clientId, clientSecret, redirectUrl)
} else if isGothSupport(providerType) {
return NewGothIdProvider(providerType, clientId, clientSecret, redirectUrl)
}
return nil
}
var gothList = []string{"Apple", "AzureAd", "Slack"}
func isGothSupport(provider string) bool {
for _, value := range gothList {
if strings.EqualFold(value, provider) {
return true
}
}
return false
}