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

Function TestPKCES256Generation

coderd/oauth2provider/pkce_test.go:64–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestPKCES256Generation(t *testing.T) {
65 t.Parallel()
66
67 // Test that we can generate a valid S256 challenge from a verifier
68 verifier := "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
69 expectedChallenge := "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
70
71 // Generate challenge using S256 method
72 h := sha256.Sum256([]byte(verifier))
73 challenge := base64.RawURLEncoding.EncodeToString(h[:])
74
75 require.Equal(t, expectedChallenge, challenge)
76 require.True(t, oauth2provider.VerifyPKCE(challenge, verifier))
77}
78
79func TestValidatePKCECodeChallengeMethod(t *testing.T) {
80 t.Parallel()

Callers

nothing calls this directly

Calls 2

VerifyPKCEFunction · 0.92
EqualMethod · 0.45

Tested by

no test coverage detected