liveBook · Manning

Oauth2 login

As explained in Spring Security in Action, Second Edition

OAuth 2 login is an authentication flow in which an application obtains a user's identity through an OAuth 2 provider.

OAuth 2 login lets a Spring web application authenticate users through an external authorization server. Spring Security handles the authorization-code redirect flow, then returns authenticated users to the application. section 16.1 section 16.1.1

A standard implementation proceeds in a small sequence:

  • Use preconfigured details for Google, GitHub, Okta, or Facebook, or define provider metadata for another authorization server. section 16.1.1 section 16.1.3

Custom authorization server

A custom provider uses a redirect URI such as http://localhost:8080/login/oauth2/code/my_authorization_server. The client registration supplies the client ID, secret, provider name, authentication method, and matching redirect configuration.

How Spring Security in Action, Second Edition covers it

How deep it goes
Explains automatic provider defaults, authorization-code redirects, client properties, and custom-provider registration.
Examples
Uses Google and GitHub login, then demonstrates a custom authorization server with a selectable provider entry.
What it assumes
Assumes basic Spring web application skills and provider registration while teaching OAuth 2 client configuration.
What you can do after
Build it from scratch by configuring Spring Security, provider credentials, redirect URIs, and custom provider metadata.
How it connects
Connects OAuth 2 clients with authorization servers, OpenID Connect, authorization-code grants, and redirect URIs.

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.