MCPcopy Index your code
hub / github.com/coder/coder / TokenRevocationRequestRFC7009

Method TokenRevocationRequestRFC7009

coderd/externalauth/externalauth.go:618–636  ·  view source on GitHub ↗
(ctx context.Context, link database.ExternalAuthLink)

Source from the content-addressed store, hash-verified

616}
617
618func (c *Config) TokenRevocationRequestRFC7009(ctx context.Context, link database.ExternalAuthLink) (*http.Request, error) {
619 p := url.Values{}
620 p.Add("client_id", c.ClientID)
621 p.Add("client_secret", c.ClientSecret)
622 if link.OAuthRefreshToken != "" {
623 p.Add("token_type_hint", "refresh_token")
624 p.Add("token", link.OAuthRefreshToken)
625 } else {
626 p.Add("token_type_hint", "access_token")
627 p.Add("token", link.OAuthAccessToken)
628 }
629 req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.RevokeURL, strings.NewReader(p.Encode()))
630 if err != nil {
631 return nil, err
632 }
633 req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", link.OAuthAccessToken))
634 req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
635 return req, nil
636}
637
638func (c *Config) TokenRevocationRequestGitHub(ctx context.Context, link database.ExternalAuthLink) (*http.Request, error) {
639 // GitHub doesn't follow RFC spec

Callers 1

Calls 3

EncodeMethod · 0.80
AddMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected