File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,16 @@ function initialize (app, argv) {
3131 app . use ( '/' , middleware ( oidc ) )
3232
3333 // Perform the actual authentication
34- app . use ( '/' , oidc . rs . authenticate ( ) )
34+ app . use ( '/' , async ( req , res , next ) => {
35+ oidc . rs . authenticate ( ) ( req , res , ( err ) => {
36+ // Error handling should be deferred to the ldp in case a user with a bad token is trying
37+ // to access a public resource
38+ if ( err ) {
39+ req . authError = err
40+ }
41+ next ( )
42+ } )
43+ } )
3544
3645 // Expose session.userId
3746 app . use ( '/' , ( req , res , next ) => {
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ function allow (mode, checkPermissionsForDirectory) {
6666 }
6767 }
6868 }
69- const error = await req . acl . getError ( userId , mode )
69+ const error = req . authError || await req . acl . getError ( userId , mode )
7070 debug ( `${ mode } access denied to ${ userId || '(none)' } : ${ error . status } - ${ error . message } ` )
7171 next ( error )
7272 }
You can’t perform that action at this time.
0 commit comments