MCPcopy Create free account
hub / github.com/apache/pulsar-client-go / NewDefaultDeviceCodeFlow

Function NewDefaultDeviceCodeFlow

oauth2/device_code_flow.go:82–106  ·  view source on GitHub ↗

NewDefaultDeviceCodeFlow provides an easy way to build up a default device code flow with all the correct configuration. If refresh tokens should be allowed pass in true for

(options DeviceCodeFlowOptions,
	callback DeviceCodeCallback)

Source from the content-addressed store, hash-verified

80// device code flow with all the correct configuration. If refresh tokens should
81// be allowed pass in true for <allowRefresh>
82func NewDefaultDeviceCodeFlow(options DeviceCodeFlowOptions,
83 callback DeviceCodeCallback) (*DeviceCodeFlow, error) {
84 wellKnownEndpoints, err := GetOIDCWellKnownEndpointsFromIssuerURL(options.IssuerEndpoint)
85 if err != nil {
86 return nil, err
87 }
88
89 codeProvider := NewLocalDeviceCodeProvider(
90 LocalDeviceCodeProviderOptions{
91 ClientID: options.ClientID,
92 },
93 *wellKnownEndpoints,
94 &http.Client{},
95 )
96
97 tokenRetriever := NewTokenRetriever(&http.Client{})
98
99 return newDeviceCodeFlow(
100 options,
101 *wellKnownEndpoints,
102 codeProvider,
103 tokenRetriever,
104 callback,
105 clock.RealClock{}), nil
106}
107
108var _ Flow = &DeviceCodeFlow{}
109

Callers

nothing calls this directly

Calls 4

NewTokenRetrieverFunction · 0.85
newDeviceCodeFlowFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…