add oidc provider for auth

This commit is contained in:
capric98
2022-06-25 23:47:00 +08:00
parent a3593212c5
commit 2fa31a6947
6 changed files with 174 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ const (
google_provider_name = "google"
azure_ad_provider_name = "azure-ad"
github_provider_name = "github"
oidc_provider_name = "oidc"
verify_user = "verifyuser"
auth_key = "netmaker_auth"
)
@@ -41,6 +42,8 @@ func getCurrentAuthFunctions() map[string]interface{} {
return azure_ad_functions
case github_provider_name:
return github_functions
case oidc_provider_name:
return oidc_functions
default:
return nil
}
@@ -71,6 +74,11 @@ func InitializeAuthProvider() string {
logger.Log(1, "external OAuth detected, proceeding with https redirect: ("+serverConn+")")
}
if authInfo[0] == "oidc" {
functions[init_provider].(func(string, string, string, string))(serverConn+"/api/oauth/callback", authInfo[1], authInfo[2], authInfo[3])
return authInfo[0]
}
functions[init_provider].(func(string, string, string))(serverConn+"/api/oauth/callback", authInfo[1], authInfo[2])
return authInfo[0]
}