liveBook · Manning

Chapter 12: Implementing filtering at the method level

What you will learn in chapter 12 of Spring Security in Action, Second Edition

The introduction explains how method-level filtering differs from call authorization, when prefiltering and postfiltering occur, and which parameter and return types they can filter.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains how method-level filtering differs from call authorization, when prefiltering and postfiltering occur, and which parameter and return types they can filter.

Key terms: filtering, call authorization, @PreAuthorize, @PostAuthorize, prefiltering, postfiltering, collections, arrays

12.1 Applying prefiltering for method authorization

This section explains how Spring Security filters method arguments before a method runs, demonstrates an ownership rule with @PreFilter, and shows why the input collection must be mutable.

Key terms: prefiltering, aspect, @PreFilter, authorization rules, business logic, authenticated user, @EnableMethodSecurity, SpEL, filterObject, authentication.name

12.2 Applying postfiltering for method authorization

The section explains how postfiltering removes unauthorized items from a method’s returned collection, then applies it to products owned by the authenticated user.

Key terms: postfiltering, aspect, returned collection, @PostFilter, SpEL, filterObject, authentication, SecurityContext

12.3 Using filtering in Spring Data repositories

This section compares filtering Spring Data repository results in the application with restricting the repository query so the database returns only authorized records.

Key terms: @PostFilter, @PreFilter, Spring Data repositories, SecurityEvaluationContextExtension, SpEL, WHERE clause, ProductRepository, authenticated user

12.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 11: Implementing authorization at the method level Chapter 13: What are OAuth 2 and OpenID Connect? →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.