MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / GenerateCodeChallenge

Function GenerateCodeChallenge

pkg/encryption/utils.go:95–105  ·  view source on GitHub ↗
(method, codeVerifier string)

Source from the content-addressed store, hash-verified

93}
94
95func GenerateCodeChallenge(method, codeVerifier string) (string, error) {
96 switch method {
97 case CodeChallengeMethodPlain:
98 return codeVerifier, nil
99 case CodeChallengeMethodS256:
100 shaSum := sha256.Sum256([]byte(codeVerifier))
101 return base64.RawURLEncoding.EncodeToString(shaSum[:]), nil
102 default:
103 return "", fmt.Errorf("unknown challenge method: %v", method)
104 }
105}
106
107func cookieSignature(signer func() hash.Hash, args ...string) (string, error) {
108 h := hmac.New(signer, []byte(args[0]))

Callers 1

doOAuthStartMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected