Skip to content

Commit 0354c2c

Browse files
Support overriding state variable
1 parent db991ec commit 0354c2c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

openid_connect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ function getAuthZArgs(r) {
259259

260260
authZArgs += "&code_challenge_method=S256&code_challenge=" + pkce_code_challenge + "&state=" + r.variables.pkce_id;
261261
} else {
262-
authZArgs += "&state=0";
262+
authZArgs += "&state=" + r.variables.state;
263263
}
264264
return authZArgs;
265265
}
@@ -272,4 +272,4 @@ function idpClientAuth(r) {
272272
} else {
273273
return "code=" + r.variables.arg_code + "&client_secret=" + r.variables.oidc_client_secret;
274274
}
275-
}
275+
}

openid_connect_configuration.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ map $host $oidc_hmac_key {
4343
default "ChangeMe";
4444
}
4545

46+
map $host $state {
47+
# Unable to use this state if PKCE is enabled
48+
default 0;
49+
}
50+
51+
4652
map $proto $oidc_cookie_flags {
4753
http "Path=/; SameSite=lax;"; # For HTTP/plaintext testing
4854
https "Path=/; SameSite=lax; HttpOnly; Secure;"; # Production recommendation

0 commit comments

Comments
 (0)