liveBook · Manning

Chapter 8: Configuring endpoint-level authorization: Applying restrictions

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

This introduction explains why applications need authorization rules for different requests and identifies the basic purpose of two matcher methods.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction explains why applications need authorization rules for different requests and identifies the basic purpose of two matcher methods.

Key terms: authorization constraints, endpoints, requests, anyRequest(), requestMatchers(), path, HTTP method

8.1 Using the requestMatchers() method to select endpoints

Shows how request matchers assign different role requirements to endpoints, how a general rule handles other requests, and why permitAll does not bypass failed authentication.

Key terms: requestMatchers(), ADMIN role, MANAGER role, HTTP 403 Forbidden, anyRequest(), permitAll(), authenticated(), denyAll(), authentication, authorization

8.2 Selecting requests to apply authorization restrictions

This section shows how to select requests by HTTP method, path pattern, or path-variable value when applying endpoint authorization rules.

Key terms: requestMatchers(), HttpMethod, paths, ANT syntax, path expressions, **, *, path variable, regex, parameter expressions

8.3 Using regular expressions with request matchers

This section explains when to use regular expressions for endpoint request matching and illustrates the choice with path-variable and video-authorization examples.

Key terms: path expressions, regexes, request matchers, path variable, path expression, /email/{email}, requestMatchers(), RegexRequestMatcher, /video/{country}/{language}, premium authority

8.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 7: Configuring endpoint-level authorization: Restricting access Chapter 9: Configuring CSRF protection →

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.