File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ class SocketServer {
222222 */
223223 middlewares ( ) {
224224 const base = this ;
225+
225226 function wrapMiddleware ( middleware ) {
226227 return ( socket , next ) => {
227228 let nextCalled = false ;
@@ -366,9 +367,13 @@ class SocketServer {
366367 /**
367368 * Enforce that socket request is authenticated (no anonymous)
368369 * @param {Object } socket Server socket
370+ * @param {Function } next Call next
369371 */
370372 enforceAuth ( socket , next ) {
371- if ( cds . context ?. user ?. _is_anonymous || ( socket . request . isAuthenticated && ! socket . request . isAuthenticated ( ) ) ) {
373+ if (
374+ cds . context ?. user ?. _is_anonymous ||
375+ ( typeof socket . request ?. isAuthenticated === "function" && ! socket . request ?. isAuthenticated ( ) )
376+ ) {
372377 const err = new Error ( "401" ) ;
373378 err . code = 4401 ;
374379 return next ( err ) ;
You can’t perform that action at this time.
0 commit comments