System Requirements
Spring Authorization Server requires JDK1.8 and above.
Project build
- Use the online project initializer https://start.spring.io/ to generate the project
[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-ljKbMI4H-1690726855433)(images/screenshot_1690602511482.png)]
- The automatically generated project will contain spring-boot-starter-web, spring-boot-starter-tomcat and spring-boot-starter-test.
- Add the dependency of Spring Authorization Server
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-authorization-server</artifactId>
<version>0.4.3</version>
</dependency>
- Configuration
To use Spring Authorization Server to implement OAuth2 authentication server, some beans must be configured, the following configuration is the minimum:
package com.osxm.sb.security.authserver.config;
import java.security.KeyPair;
import java.security.