File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ function codeExchange(r) {
188
188
r . log ( "OIDC success, creating session " + r . variables . request_id ) ;
189
189
r . variables . new_session = tokenset . id_token ; // Create key-value store entry
190
190
r . headersOut [ "Set-Cookie" ] = "auth_token=" + r . variables . request_id + "; " + r . variables . oidc_cookie_flags ;
191
- r . return ( 302 , r . variables . redirect_base + r . variables . cookie_auth_redir ) ;
191
+ redirectPostLogin ( r ) ;
192
192
}
193
193
) ;
194
194
} catch ( e ) {
@@ -253,6 +253,15 @@ function validateIdToken(r) {
253
253
}
254
254
}
255
255
256
+ // Redirect URI after successful login from the OP.
257
+ function redirectPostLogin ( r ) {
258
+ if ( r . variables . oidc_landing_page ) {
259
+ r . return ( 302 , r . variables . oidc_landing_page ) ;
260
+ } else {
261
+ r . return ( 302 , r . variables . redirect_base + r . variables . cookie_auth_redir ) ;
262
+ }
263
+ }
264
+
256
265
function logout ( r ) {
257
266
r . log ( "OIDC logout for " + r . variables . cookie_auth_token ) ;
258
267
r . variables . session_jwt = "-" ;
Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ map $host $oidc_scopes {
44
44
default "openid+profile+email+offline_access" ;
45
45
}
46
46
47
+ map $host $oidc_landing_page {
48
+ # Where to send browser after successful login. If empty, redirects User
49
+ # Agent to $request_uri.
50
+ default "" ;
51
+ #www.example.com $redirect_base;
52
+ }
53
+
47
54
map $host $oidc_logout_redirect {
48
55
# Where to send browser after requesting /logout location. This can be
49
56
# replaced with a custom logout page, or complete URL.
You can’t perform that action at this time.
0 commit comments