liveBook · Manning

OAuth

As explained in Spring Security in Action, Second Edition

OAuth 2 is an authorization framework specification for delegated access to protected resources using access tokens.

OAuth 2.0 is an authorization framework for delegated access to protected resources. It separates the user, client, resource server, and authorization server: the authorization server authenticates users and clients, then issues access tokens that the client presents to a resource server. section 13.6

Implementations commonly distinguish these mechanisms:

  • Use opaque tokens when the resource server validates them through authorization-server introspection; use non-opaque tokens when the token carries details, commonly as a JWT. section 13.6
  • Obtain tokens through grant types such as authorization code or client credentials; add PKCE to authorization code flows when supplementary protection is needed. section 13.6
  • Use refresh tokens when an application needs new access tokens without requiring the user to authenticate again. section 13.6
  • Treat OpenID Connect as a protocol built over OAuth 2 that constrains the framework with values such as openid and profile scopes and an ID token. section 13.4

Spring Security clients

Configure a Spring web application to authenticate through GitHub, Google, Facebook, Okta, or another provider. Common providers supply known OAuth 2 details, while custom providers require authorization, token, and key-set URIs. For backend-to-backend calls, use the client credentials grant and Spring Security's client manager to obtain an access token. section 16.3

How Spring Security in Action, Second Edition covers it

How deep it goes
Explains actors, token categories, grant types, PKCE, refresh tokens, and Spring configuration, without detailing protocol message exchanges.
Examples
Demonstrates external-provider login, custom provider URIs, opaque-token introspection, client credentials, and Spring Security client managers.
What it assumes
Assume Java and basic Spring Framework knowledge while teaching OAuth 2 actors, tokens, grants, and Spring Security application patterns.
What you can do after
Apply OAuth 2 through Spring Security for external login and backend-to-backend access-token requests.
How it connects
Connects authorization servers, resource servers, access tokens, JWTs, PKCE, refresh tokens, OpenID Connect, and Spring Security.

Also explained in

Compare how 9 books explain OAuth →

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.