Skip to content

Commit a2f3d97

Browse files
authored
Merge pull request #8 from linuxfoundation/jme/LFXV2-235
Allow RS256 or PS256 as JWT signing algorithm
2 parents f7feb1e + 104de41 commit a2f3d97

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

.github/workflows/license-header-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
jobs:
1313
license-header-check:
1414
name: License Header Check
15-
uses: linuxfoundation/lfx-public-workflows/.github/workflows/license-header-check.yml@main
15+
uses: linuxfoundation/lfx-public-workflows/.github/workflows/license-header-check.yml@c465d6571fa0b8be9d551d902955164ea04a00af
1616
with:
1717
copyright_line: "Copyright The Linux Foundation and each contributor to LFX."
1818
exclude_pattern: "gen/*"

charts/lfx-v2-query-service/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ apiVersion: v2
55
name: lfx-v2-query-service
66
description: LFX Platform V2 Query Service chart
77
type: application
8-
version: 0.2.1
8+
version: 0.2.2
99
appVersion: "latest"

charts/lfx-v2-query-service/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ spec:
3232
key: PAGE_TOKEN_SECRET
3333
- name: JWKS_URL
3434
value: {{ .Values.jwks.url }}
35+
- name: JWT_SIGNATURE_ALGORITHM
36+
value: {{ .Values.jwt.signatureAlgorithm | default "PS256" }}
3537
envFrom:
3638
- secretRef:
3739
name: {{ .Values.secret.name }}

charts/lfx-v2-query-service/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,5 @@ secret:
5959

6060
jwks:
6161
url: http://lfx-platform-heimdall:4457/.well-known/jwks
62+
jwt:
63+
signatureAlgorithm: PS256

cmd/query_svc/jwt.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import (
1919

2020
const (
2121
// PS256 is the default for Heimdall's JWT finalizer.
22-
signatureAlgorithm = validator.PS256
23-
defaultIssuer = "heimdall"
24-
defaultAudience = "lfx-v2-query-service"
22+
ps256 = validator.PS256
23+
rs256 = validator.RS256
24+
defaultIssuer = "heimdall"
25+
defaultAudience = "lfx-v2-query-service"
2526
)
2627

2728
var (
@@ -75,6 +76,10 @@ func SetupJWTAuth(ctx context.Context) {
7576
}
7677
provider := jwks.NewCachingProvider(issuer, 5*time.Minute, jwks.WithCustomJWKSURI(jwksURL))
7778

79+
signatureAlgorithm := ps256
80+
if os.Getenv("JWT_SIGNATURE_ALGORITHM") == "RS256" {
81+
signatureAlgorithm = rs256
82+
}
7883
// Set up the JWT validator.
7984
audience := os.Getenv("AUDIENCE")
8085
if audience == "" {

0 commit comments

Comments
 (0)