MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / AuthURL

Method AuthURL

cmd/cql-proxy/auth/admin.go:89–113  ·  view source on GitHub ↗

AuthURL returns the oauth auth url for github oauth authentication.

(state string, clientID string, callback string)

Source from the content-addressed store, hash-verified

87
88// AuthURL returns the oauth auth url for github oauth authentication.
89func (a *AdminAuth) AuthURL(state string, clientID string, callback string) (realState string, authURL string) {
90 if a.OAuthEnabled() {
91 var opts []oauth2.AuthCodeOption
92
93 if callback != "" {
94 opts = append(opts, oauth2.SetAuthURLParam("redirect_uri", callback))
95 }
96
97 var (
98 oauthCfg *oauth2.Config
99 ok bool
100 )
101
102 if oauthCfg, ok = a.oauthCfg[clientID]; !ok || clientID == "" {
103 oauthCfg = a.oauthCfg["default"]
104 } else {
105 // append client_id to state
106 state = state + ":" + clientID
107 }
108
109 return state, oauthCfg.AuthCodeURL(state, opts...)
110 }
111
112 return "", ""
113}
114
115// HandleLogin returns the tokens for github oauth authentication.
116func (a *AdminAuth) HandleLogin(ctx context.Context, state string, auth string) (userInfo *AdminUserInfo, err error) {

Callers 1

adminOAuthAuthorizeFunction · 0.80

Calls 1

OAuthEnabledMethod · 0.95

Tested by

no test coverage detected