1
0
mirror of https://github.com/smallstep/cli.git synced 2025-08-09 03:22:43 +03:00

Use S256 as the code challenge method.

This commit is contained in:
Mariano Cano
2019-03-15 11:52:14 -07:00
parent 869f5aedaf
commit 64066b65cd

View File

@@ -2,6 +2,8 @@ package oauth
import (
"bufio"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"encoding/pem"
"fmt"
@@ -701,8 +703,9 @@ func (o *oauth) Auth() (string, error) {
q.Add("response_type", "id_token token")
} else {
q.Add("response_type", "code")
q.Add("code_challenge_method", "plain")
q.Add("code_challenge", o.codeChallenge)
q.Add("code_challenge_method", "S256")
s256 := sha256.Sum256([]byte(o.codeChallenge))
q.Add("code_challenge", base64.RawURLEncoding.EncodeToString(s256[:]))
}
q.Add("scope", o.scope)
q.Add("state", o.state)