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

Function extractRevocationRequest

coderd/oauth2provider/revoke.go:31–49  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

29)
30
31func extractRevocationRequest(r *http.Request) (codersdk.OAuth2TokenRevocationRequest, error) {
32 if err := r.ParseForm(); err != nil {
33 return codersdk.OAuth2TokenRevocationRequest{}, xerrors.Errorf("invalid form data: %w", err)
34 }
35
36 req := codersdk.OAuth2TokenRevocationRequest{
37 Token: r.Form.Get("token"),
38 TokenTypeHint: codersdk.OAuth2RevocationTokenTypeHint(r.Form.Get("token_type_hint")),
39 ClientID: r.Form.Get("client_id"),
40 ClientSecret: r.Form.Get("client_secret"),
41 }
42
43 // RFC 7009 requires 'token' parameter.
44 if req.Token == "" {
45 return codersdk.OAuth2TokenRevocationRequest{}, xerrors.New("missing token parameter")
46 }
47
48 return req, nil
49}
50
51// RevokeToken implements RFC 7009 OAuth2 Token Revocation
52// Authentication is unique for this endpoint in that it does not use the

Callers 1

RevokeTokenFunction · 0.85

Calls 4

GetMethod · 0.65
NewMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected