Skip to content

Commit 3ed12f7

Browse files
committed
fix: enable es256 jwt signing algorithm support for gotrue
1 parent 08bf47a commit 3ed12f7

File tree

3 files changed

+158
-1
lines changed

3 files changed

+158
-1
lines changed

internal/start/start.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,22 @@ EOF
531531
fmt.Sprintf("GOTRUE_RATE_LIMIT_WEB3=%v", utils.Config.Auth.RateLimit.Web3),
532532
}
533533

534-
// Since signing key is validated by ResolveJWKS, simply read the key file.
535534
if keys, err := afero.ReadFile(fsys, utils.Config.Auth.SigningKeysPath); err == nil && len(keys) > 0 {
536535
env = append(env, "GOTRUE_JWT_KEYS="+string(keys))
536+
algSet := map[string]bool{"HS256": true}
537+
for _, key := range utils.Config.Auth.SigningKeys {
538+
switch key.Algorithm {
539+
case config.AlgRS256:
540+
algSet["RS256"] = true
541+
case config.AlgES256:
542+
algSet["ES256"] = true
543+
}
544+
}
545+
algorithms := make([]string, 0, len(algSet))
546+
for alg := range algSet {
547+
algorithms = append(algorithms, alg)
548+
}
549+
env = append(env, "GOTRUE_JWT_VALID_METHODS="+strings.Join(algorithms, ","))
537550
}
538551

539552
if utils.Config.Auth.Email.Smtp != nil && utils.Config.Auth.Email.Smtp.Enabled {

pkg/api/client.gen.go

Lines changed: 135 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/types.gen.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)