liveBook · Manning

WebExpressionAuthorizationManager

As explained in Spring Security in Action, Second Edition

WebExpressionAuthorizationManager is a Spring Security AuthorizationManager implementation that evaluates web authorization decisions from Spring Expression Language expressions.

WebExpressionAuthorizationManager is a Spring Security AuthorizationManager implementation for evaluating web authorization decisions from Spring Expression Language (SpEL) expressions. It is commonly used through the authorizeHttpRequests().access() method when simpler authority checks are insufficient. section 7.1.1

Expression rules can combine authority checks, such as requiring read access while rejecting delete authority. Because these rules are less readable than hasAuthority() or hasAnyAuthority(), use them when the simpler methods cannot express the requirement. section 7.1.1

Expression-based endpoint restriction

Configure every request with c -> c.anyRequest().access("hasAuthority('WRITE')"). A user with WRITE receives the endpoint response; a user without it receives HTTP 403 Forbidden. section 7.1.1

How Spring Security in Action, Second Edition covers it

How deep it goes
Defines the implementation and demonstrates simple and compound expressions, but does not descend into expression evaluation internals.
Examples
Uses WRITE-only access and a compound read-without-delete expression tested with authenticated users.
What it assumes
Assumes basic Spring Security configuration, authenticated users, authorities, and endpoint request matching.
What you can do after
Apply it via Spring Security's access() method to configure expression-based endpoint authorization.
How it connects
Connects AuthorizationManager, Spring Expression Language, SecurityFilterChain, hasAuthority(), and hasAnyAuthority().

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Security in Action, Second Edition. The section links point to the parts of the book it draws on.