File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 AdminForthResourcePages ,
2929 AdminForthDataTypes ,
3030 Predicate ,
31+ AdminUser ,
3132} from "../types/Common.js" ;
3233import AdminForth from "adminforth" ;
3334import { AdminForthConfigMenuItem } from "adminforth" ;
@@ -1216,6 +1217,16 @@ export default class ConfigValidator implements IConfigValidator {
12161217 }
12171218 }
12181219
1220+ if ( ! newConfig . auth . websocketTopicAuth ) {
1221+ newConfig . auth . websocketTopicAuth = async ( topic : string , adminUser : AdminUser ) => {
1222+ if ( ! adminUser ) {
1223+ // don't allow anonymous users to subscribe
1224+ return false ;
1225+ }
1226+ return true ;
1227+ }
1228+ }
1229+
12191230 newConfig . auth . rateLimit = newConfig . auth . rateLimit || [ ...DEFAULT_AUTH_RATE_LIMIT ] ;
12201231 if ( ! Array . isArray ( newConfig . auth . rateLimit ) ) {
12211232 errors . push ( `auth.rateLimit must be an array of strings in format "500/5m"` ) ;
You can’t perform that action at this time.
0 commit comments