MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / connect

Method connect

server-source-code/internal/auth/oidc/client.go:78–98  ·  view source on GitHub ↗

connect performs provider discovery and populates the oauth2 config and token verifier. It is idempotent and safe for concurrent callers.

(ctx context.Context)

Source from the content-addressed store, hash-verified

76// connect performs provider discovery and populates the oauth2 config and token
77// verifier. It is idempotent and safe for concurrent callers.
78func (c *Client) connect(ctx context.Context) error {
79 c.mu.Lock()
80 defer c.mu.Unlock()
81 if c.provider != nil {
82 return nil
83 }
84 provider, err := oidc.NewProvider(ctx, c.cfg.IssuerURL)
85 if err != nil {
86 return fmt.Errorf("oidc: discover provider: %w", err)
87 }
88 c.provider = provider
89 c.verifier = provider.Verifier(&oidc.Config{ClientID: c.cfg.ClientID})
90 c.oauth2 = &oauth2.Config{
91 ClientID: c.cfg.ClientID,
92 ClientSecret: c.cfg.ClientSecret,
93 RedirectURL: c.cfg.RedirectURI,
94 Endpoint: provider.Endpoint(),
95 Scopes: c.scopes,
96 }
97 return nil
98}
99
100func parseScopes(s string) []string {
101 if s == "" {

Callers 3

RdpViewerFunction · 0.95
AuthCodeURLMethod · 0.95
ExchangeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected