We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The set of authorization rules declared in the Java DSL can get messy if not formatted properly. For example, a declaration like this:
http .authorizeHttpRequests((authorize) -> authorize .requestMatchers("/js/**", "/css/**", "/error").permitAll() .requestMatchers(HttpMethod.GET, "/api/**").hasAuthority("api") .anyRequest().denyAll() )
can quickly become hard to reason about when written like this:
http .authorizeHttpRequests((authorize) -> authorize .requestMatchers("/js/**", "/css/**", "/error").permitAll().requestMatchers(HttpMethod.GET, "/api/**").hasAuthority("api").anyRequest().denyAll()() )
The DSL could help users write authorization rules in a way that's easier to comprehend over time by requiring that rules be declared one at a time:
http .authorizeHttpRequests((request) -> { request.uris("/js/**", "/css/**", "/error").authorize().everyone(); request.methods(HttpMethod.GET).uris("/api/**").authorize().authorities("api:read"); request.unmatched().authorize().none(); })
This would be achieved by having the authorization methods (permitAll, authorities, etc.) return void.
permitAll
authorities
void
When there is only one rule, this simplifies to:
http .authorizeHttpRequests((requests) -> requests.authorize().authenticated())
The text was updated successfully, but these errors were encountered:
jzheaux
No branches or pull requests
The set of authorization rules declared in the Java DSL can get messy if not formatted properly. For example, a declaration like this:
can quickly become hard to reason about when written like this:
The DSL could help users write authorization rules in a way that's easier to comprehend over time by requiring that rules be declared one at a time:
This would be achieved by having the authorization methods (
permitAll
,authorities
, etc.) returnvoid
.When there is only one rule, this simplifies to:
The text was updated successfully, but these errors were encountered: