package sso import ( "fmt" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests" "net/url" "strings" ) func GetLoginUrl(ident string, redirectUrl string, env ...string) string { uri := fmt.Sprintf("/admin/main/login?ident=%s&redirectUrl=%s", ident, url.QueryEscape(redirectUrl)) scheme, host := getSchemeAndHost(env...) return fmt.Sprintf("%s://%s%s", scheme, host, uri) } func GetLogout(ident string, env ...string) string { uri := fmt.Sprintf("/admin/main/logout?ident=%s&redirectUrl=", ident) scheme, host := getSchemeAndHost(env...) return fmt.Sprintf("%s://%s%s", scheme, host, uri) } func getSchemeAndHost(env ...string) (scheme, host string) { env = append(env, requests.RELEASE) host = HOST.Func(env[0], "") scheme = strings.ToLower(requests.HTTPS) return }