https://github.com/chensoul/spring-security-5-oauth2-samples
基于 Spring Security 5 搭建 OAuth2 授权和认证服务。
https://github.com/chensoul/spring-security-5-oauth2-samples
spring-security-oauth2 spring-security-oauth2-boot
Last synced: 4 months ago
JSON representation
基于 Spring Security 5 搭建 OAuth2 授权和认证服务。
- Host: GitHub
- URL: https://github.com/chensoul/spring-security-5-oauth2-samples
- Owner: chensoul
- License: apache-2.0
- Created: 2024-10-21T23:30:34.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-14T01:24:14.000Z (4 months ago)
- Last Synced: 2025-02-14T02:33:29.478Z (4 months ago)
- Topics: spring-security-oauth2, spring-security-oauth2-boot
- Language: Java
- Homepage:
- Size: 250 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# spring-security-5-oauth2-samples | [English Documentation](README.md)
使用 [Spring Security OAuth2 Boot](https://github.com/spring-attic/spring-security-oauth2-boot) 搭建 OAuth2
授权和认证服务。Spring Security OAuth2 Boot
在2022年5月31日归档,不再维护,推荐使用 [Spring Authorization Server](https://github.com/spring-projects/spring-authorization-server)
代替。## 如何运行
### 生成证书
JRE 提供了一个简单的证书管理工具——keytool。它位于您的JRE_HOME\bin目录下。以下代码中的命令生成一个自签名证书并将其放入
PKCS12 KeyStore 中。除了 KeyStore 的类型之外,您还需要设置其有效期、别名以及文件名。在开始生成过程之前,keytool会要求您输入密码和一些其他信息,如下所示:```bash
keytool -genkeypair -alias mytest -keyalg RSA -keysize 2048 \
-storetype PKCS12 -keystore mytest.p12 -storepass mypass \
-dname "CN=WebServer,OU=Unit,O=Organization,L=City,S=State,C=CN" -validity 3650
```导出公钥文件:
```bash
keytool -list -rfc --keystore mytest.p12 -storepass mypass | \
openssl x509 -inform pem -pubkey > public.key
```导出私钥文件:
```bash
keytool -importkeystore -srckeystore mytest.p12 -srcstorepass mypass \
-destkeystore private.p12 -deststoretype PKCS12 \
-deststorepass mypass -destkeypass mytest#输入 storepass 密码
openssl pkcs12 -in private.p12 -nodes -nocerts -out private.key
```## 贡献
非常欢迎[提出请求](https://help.github.com/articles/creating-a-pull-request) 。
## 许可
learn-spring-authorization-server 是在 [Apache 2.0 许可](https://www.apache.org/licenses/LICENSE-2.0.html)
下发布的开源软件 。