How spring-projects/spring-authorization-server works
This project is the Spring Authorization Server—a library and server implementation that provides OAuth 2.1 (and related OAuth 2.0) authorization server functionality. It is not a full-stack application per se but rather a server-side framework that leverages Spring Security’s OAuth 2.0 Core, Client, Resource Server, and JOSE modules. It also includes many sample applications (clients, demo authorization servers, SPA clients, etc.) to illustrate how the server and its integrations can be used.
Main components
• Authorization Server Core – This is the heart of the system. It comprises components handling OAuth2 endpoints (like /authorize, /token, /consent, etc.), token issuance logic, client registration, and various authentication providers.
• Authentication & Token Processing – Modules that include authentication converters, authentication providers, token generators (access and refresh tokens), and related validation components.
• OIDC and OAuth2 Extensions – Components supporting OpenID Connect (OIDC) such as userinfo, client registration endpoints, and custom id token and claim handling.
• Integration with Spring Security Modules – The project leverages several Spring Security modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) that should be shown as dependencies or collaborating modules.
• Persistence/Repository Layer – Although the core is framework code, there are implementations (in-memory, JDBC, JPA, Redis, etc.) for managing clients, authorizations, and consents.
• Build and Configuration Infrastructure – The buildSrc folder holds custom Gradle plugins and conventions used to configure and standardize the project build. This is also key in the overall architecture.
• Documentation and Samples – The separate docs and samples directories demonstrate various integrations and deployment examples (Backend-for-SPA, default or demo authorization server, demo client, etc.). These samples illustrate different deployment configurations and runtime integrations.
Component relationships and interactions
• That the various OAuth2 authentication providers (e.g., Authorization Code Authentication Provider, Refresh Token Provider, Client Credentials Provider, Device Code Provider, etc.) are all plugged into the central authentication context.
• That the different persistence implementations (In-memory, JDBC, JPA, Redis) plug into the repositories responsible for storing client registration and authorization details.
• Build configuration and Gradle plugins (from buildSrc) as supporting layers that define project conventions and documentation deployment (e.g., the Antora docs build).
Important architectural patterns
• Extensibility: The design accommodates custom authentication flows (such as device authentication and custom grant types) and an extensible client registration flow, which should be highlighted as optional extension points.
Relevant technologies and frameworks
• Gradle (build automation)
• Java 17 (as required)
• Spring Framework (Spring Security, Spring Boot if applicable in samples)
• OAuth 2.1 / OAuth 2.0 standards and OpenID Connect for authentication and authorization
• Integration with external modules like Spring Security OAuth components and JOSE libraries for token security
• Persistence technologies indicated in examples (JPA, JDBC, Redis)