(ctx context.Context, link database.ExternalAuthLink)
| 616 | } |
| 617 | |
| 618 | func (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 | |
| 638 | func (c *Config) TokenRevocationRequestGitHub(ctx context.Context, link database.ExternalAuthLink) (*http.Request, error) { |
| 639 | // GitHub doesn't follow RFC spec |
no test coverage detected