@@ -12,10 +12,10 @@ export class AuthHandler {
1212 this . #inCloud = inCloud ;
1313 }
1414
15- #allowedPaths: Set < string > = new Set ( ) ;
15+ #allowedPaths: Set < RegExp > = new Set ( ) ;
1616 #allowedActions: Map < string , Set < string > > = new Map ( ) ;
1717
18- get allowedPaths ( ) : string [ ] {
18+ get allowedPaths ( ) : RegExp [ ] {
1919 return Array . from ( this . #allowedPaths) ;
2020 }
2121
@@ -31,8 +31,8 @@ export class AuthHandler {
3131 ) ;
3232 return actions ;
3333 }
34- allowPath ( path : string ) : void {
35- this . #allowedPaths. add ( path ) ;
34+ allowPath ( match : RegExp ) : void {
35+ this . #allowedPaths. add ( match ) ;
3636 }
3737 allowAction ( group : string , action : string ) : void {
3838 if ( ! this . #allowedActions. has ( group ) ) {
@@ -41,17 +41,19 @@ export class AuthHandler {
4141 this . #allowedActions. get ( group ) ?. add ( action ) ;
4242 }
4343
44- disallowPath ( path : string ) : void {
45- this . #allowedPaths. delete ( path ) ;
44+ disallowPath ( match : RegExp ) : void {
45+ this . #allowedPaths. delete ( match ) ;
4646 }
4747 disallowAction ( group : string , action : string ) : void {
4848 if ( this . #allowedActions. has ( group ) ) {
4949 this . #allowedActions. get ( group ) ?. delete ( action ) ;
5050 }
5151 }
5252 isPathAllowed ( path : string ) : boolean {
53- if ( this . #allowedPaths. has ( path ) ) {
54- return true ;
53+ for ( const match of this . #allowedPaths) {
54+ if ( match . test ( path ) ) {
55+ return true ;
56+ }
5557 }
5658 return false ;
5759 }
0 commit comments