Home > Blockchain >  How to white list root path with wildcard but not additional sub paths?
How to white list root path with wildcard but not additional sub paths?

Time:11-03

I'm not sure if the description is correct, but I have the following paths:

  • /feature_flags/{featureFlagName}
  • /feature_flags/{featureFlagName}/business/{businessId}

Is there a way to white list the first one but not any sub-paths:

  • /feature_flags/{featureFlagName} -> allow this only
  • /feature_flags/{featureFlagName}/xx -> block all that have additional path

CodePudding user response:

In your security config add the path with only something like:

.antMatchers("/feature_flags/*").permitAll()
.antMatchers("/feature_flags/*/**").authenticated()

Or other rules (hasRole, hasAuthority) that you may need.

  • Related