Skip to content

Commit d8096f7

Browse files
committed
Add environment variables and log discovered values
1 parent 53cc96c commit d8096f7

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

charts/jwt-nginx-ext-auth/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.0.1
18+
version: 0.0.2
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/jwt-nginx-ext-auth/templates/deployment.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ spec:
3232
{{- toYaml .Values.podSecurityContext | nindent 8 }}
3333
containers:
3434
- name: {{ .Chart.Name }}
35+
env:
36+
- name: OIDC_DISCOVERY_URL
37+
value: {{ .Values.oidcConfig.discoveryUrl }}
38+
- name: JWKS_URI
39+
value: {{ .Values.oidcConfig.jwksUri }}
40+
- name: JWT_ISSUER
41+
value: {{ .Values.oidcConfig.jwtIssuer }}
42+
- name: JWT_AUDIENCE
43+
value: {{ .Values.oidcConfig.jwtAudience }}
44+
- name: JWT_HEADER
45+
value: {{ .Values.oidcConfig.jwtHeader }}
46+
- name: PORT
47+
value: "{{ .Values.service.port }}"
3548
securityContext:
3649
{{- toYaml .Values.securityContext | nindent 12 }}
3750
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
@@ -40,14 +53,6 @@ spec:
4053
- name: http
4154
containerPort: {{ .Values.service.port }}
4255
protocol: TCP
43-
livenessProbe:
44-
httpGet:
45-
path: /
46-
port: http
47-
readinessProbe:
48-
httpGet:
49-
path: /
50-
port: http
5156
resources:
5257
{{- toYaml .Values.resources | nindent 12 }}
5358
{{- with .Values.volumeMounts }}

charts/jwt-nginx-ext-auth/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ imagePullSecrets: []
1414
nameOverride: ""
1515
fullnameOverride: ""
1616

17+
oidcConfig:
18+
discoveryUri: ""
19+
jwksUri: ""
20+
jwtIssuer: ""
21+
jwtAudience: ""
22+
jwtHeader: "authorization"
23+
1724
serviceAccount:
1825
# Specifies whether a service account should be created
1926
create: true

src/index.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ if (process.env.OIDC_DISCOVERY_URI) {
1212
jwks_uri: string;
1313
issuer: string;
1414
};
15+
console.log("Discovered JWKS_URI", discoveryJson.jwks_uri);
16+
console.log("Discovered issuer", discoveryJson.issuer);
1517
process.env.JWKS_URI = discoveryJson.jwks_uri;
1618
process.env.JWT_ISSUER = discoveryJson.issuer;
1719
}
@@ -31,7 +33,7 @@ fastify.get<{
3133
authorization: string;
3234
};
3335
}>("/", async (request, reply) => {
34-
const header = process.env.JWT_HEADER ?? "authorization";
36+
const header = (process.env.JWT_HEADER ?? "authorization").toLowerCase();
3537
if (!request.headers[header]) {
3638
reply.status(401).send({ error: "Unauthorized" });
3739
return;

0 commit comments

Comments
 (0)