MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / createFlow

Method createFlow

internal/auth/oauth2_github.go:143–179  ·  view source on GitHub ↗
(meta metadata.ConnectionAuthPendingMetadata)

Source from the content-addressed store, hash-verified

141}
142
143func (p *gitHubProvider) createFlow(meta metadata.ConnectionAuthPendingMetadata) (
144 gitHubFlow,
145 error,
146) {
147 logger := p.logger.WithLabel("connectionID", meta.ConnectionID).WithLabel("username", meta.Username)
148
149 client, err := http.NewClient(p.wwwClientConfig, logger)
150 if err != nil {
151 return gitHubFlow{}, message.WrapUser(
152 err,
153 message.EAuthGitHubHTTPClientCreateFailed,
154 "Authentication currently unavailable.",
155 "Cannot create GitHub device flow authenticator because the HTTP urlEncodedClient configuration failed.",
156 )
157 }
158
159 jsonClient, err := http.NewClient(p.jsonWWWClientConfig, logger)
160 if err != nil {
161 return gitHubFlow{}, message.WrapUser(
162 err,
163 message.EAuthGitHubHTTPClientCreateFailed,
164 "Authentication currently unavailable.",
165 "Cannot create GitHub device flow authenticator because the HTTP urlEncodedClient configuration failed.",
166 )
167 }
168
169 flow := gitHubFlow{
170 provider: p,
171 clientID: p.clientID,
172 clientSecret: p.clientSecret,
173 logger: logger,
174 client: client,
175 jsonClient: jsonClient,
176 apiClientConfig: p.apiClientConfig,
177 }
178 return flow, nil
179}
180
181func (p *gitHubProvider) getScope() string {
182 scopes := p.scopes

Callers 2

GetDeviceFlowMethod · 0.95

Calls 3

NewClientFunction · 0.92
WrapUserFunction · 0.92
WithLabelMethod · 0.65

Tested by

no test coverage detected