feat: implement PKCE when acting as oauth2 client (for user login)

Closes #2766
This commit is contained in:
oliverpool 2024-04-18 09:55:08 +02:00
parent 27fa12427c
commit e1d93950ad
5 changed files with 119 additions and 6 deletions

View file

@ -93,3 +93,10 @@ func TestNewAccessTokenResponse_OIDCToken(t *testing.T) {
assert.Equal(t, user.Email, oidcToken.Email)
assert.Equal(t, user.IsActive, oidcToken.EmailVerified)
}
func TestEncodeCodeChallenge(t *testing.T) {
// test vector from https://datatracker.ietf.org/doc/html/rfc7636#page-18
codeChallenge, err := encodeCodeChallenge("dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
assert.NoError(t, err)
assert.Equal(t, "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", codeChallenge)
}