提交Basic认证 和 OAuth2认证的配置说明文档
diff --git "a/doc/oauth2/OAuth2\350\256\244\350\257\201\347\231\273\345\275\225\346\265\201\347\250\213.png" "b/doc/oauth2/OAuth2\350\256\244\350\257\201\347\231\273\345\275\225\346\265\201\347\250\213.png"
new file mode 100644
index 0000000..cdda4b7
--- /dev/null
+++ "b/doc/oauth2/OAuth2\350\256\244\350\257\201\347\231\273\345\275\225\346\265\201\347\250\213.png"
Binary files differ
diff --git a/doc/oauth2/oauth2-approval.png b/doc/oauth2/oauth2-approval.png
new file mode 100644
index 0000000..c551fb3
--- /dev/null
+++ b/doc/oauth2/oauth2-approval.png
Binary files differ
diff --git a/doc/oauth2/oauth2-login.png b/doc/oauth2/oauth2-login.png
new file mode 100644
index 0000000..702c7a5
--- /dev/null
+++ b/doc/oauth2/oauth2-login.png
Binary files differ
diff --git "a/doc/\345\237\272\344\272\216 Basic \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.MD" "b/doc/\345\237\272\344\272\216 Basic \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.MD"
new file mode 100644
index 0000000..4707f33
--- /dev/null
+++ "b/doc/\345\237\272\344\272\216 Basic \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.MD"
@@ -0,0 +1,53 @@
+
+## 基于 Basic 认证的资源接口请求方式
+
+采用 Basic 认证,对 API 资源接口进行访问控制
+
+
+### 项目配置
+
+1、在 client 项目的 application.yml 中新增配置
+
+
+```
+infras.security.api.basic.enabled: true
+```
+
+若要禁用则,注释掉配置 或 修改为 false
+
+
+2、在 ClientApplication(项目启动类)中,添加注解 @EnableInfrasApiSecurity
+
+注,不能同时存在 注解 @EnableInfrasOAuth2
+
+
+
+### 请求 API 资源接口
+
+请求地址:/api/user
+
+请求头:
+`Authorization,认证头,Basic <user:password 的 base64 编码>`
+示例(user:password 为 admin:111111):
+`Authorization: Basic YWRtaW46MTExMTEx`
+
+请求示例:
+```
+curl -i -s -X GET -H "Authorization: Basic YWRtaW46MTExMTEx" "http://localhost:8080/api/user"
+```
+注:
+-H "Authorization: Basic YWRtaW46MTExMTEx" 为请求头参数
+
+
+响应结果:
+```
+{
+  "password":null,
+  "username":"admin",
+  "authorities":[{"authority":"ROLE_ADMIN"},{"authority":"administrator"},{"authority":"user"}],
+  "accountNonExpired":true,
+  "accountNonLocked":true,
+  "credentialsNonExpired":true,
+  "enabled":true
+}
+```
diff --git "a/doc/\345\237\272\344\272\216 Basic \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.pdf" "b/doc/\345\237\272\344\272\216 Basic \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.pdf"
new file mode 100644
index 0000000..1dad867
--- /dev/null
+++ "b/doc/\345\237\272\344\272\216 Basic \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.pdf"
Binary files differ
diff --git "a/doc/\345\237\272\344\272\216 OAuth2 \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.MD" "b/doc/\345\237\272\344\272\216 OAuth2 \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.MD"
new file mode 100644
index 0000000..6a93b1b
--- /dev/null
+++ "b/doc/\345\237\272\344\272\216 OAuth2 \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.MD"
@@ -0,0 +1,87 @@
+
+## 基于 OAuth2 认证的资源接口请求方式
+
+
+### 流程图
+
+![流程图](oauth2/OAuth2认证登录流程.png)
+
+
+### 项目配置
+
+1、在 ClientApplication(项目启动类)中,添加注解 @EnableInfrasOAuth2
+
+注,不能同时存在 注解 @EnableInfrasApiSecurity
+
+
+
+### 认证
+
+1、浏览器请求
+```
+http://localhost:8080/oauth/authorize?response_type=code&client_id=app&redirect_uri=http://example.com/index.html
+```
+
+显示登录页面,用户登录
+
+![登录页面](oauth2/oauth2-login.png)
+
+
+登录后显示 Scope 授权页面,用户选择 Approve,并授权即可
+
+![授权页面](oauth2/oauth2-approval.png)
+
+
+### 返回 code
+
+1、浏览器重定向
+
+参考地址:
+```
+http://example.com/index.html?code=SX1AUm
+```
+
+### 根据 code 获取 access_token
+
+curl 请求示例:curl 通过 Header 传递 client_id, client_secret
+```
+curl -i -s -X POST -H "Authorization: Basic YXBwOnNlY3JldA==" -d "grant_type=authorization_code&code=SX1AUm&redirect_uri=http://example.com/index.html" "http://localhost:8080/oauth/token"
+```
+注:
+-H "Authorization: Basic YXBwOnNlY3JldA==" 为请求头参数
+-d "grant_type=authorization_code&code=SX1AUm&redirect_uri=http://example.com/index.html" 为POST提交数据
+
+
+响应结果:
+```
+{
+  "access_token":"5f113f2d-b016-42fd-8353-b6b750426108",
+  "token_type":"bearer",
+  "refresh_token":"1400db36-f93a-4773-8cba-af370bac717a",
+  "expires_in":43199,
+  "scope":"app"
+}
+```
+
+
+### 根据 access_token 请求接口资源
+
+curl 请求示例:curl 通过 Header 传递 access_token
+```
+curl -i -s -X GET -H "Authorization: Bearer 5f113f2d-b016-42fd-8353-b6b750426108" "http://localhost:8080/api/user"
+```
+注:
+-H "Authorization: Bearer 5f113f2d-b016-42fd-8353-b6b750426108" 为请求头参数
+
+响应结果:
+```
+{
+  "username":"user",
+  "password":null,
+  "authorities":[{"authority":"ROLE_ADMIN"},{"authority":"administrator"},{"authority":"user"}],
+  "accountNonExpired":true,
+  "accountNonLocked":true,
+  "credentialsNonExpired":true,
+  "enabled":true
+}
+```
diff --git "a/doc/\345\237\272\344\272\216 OAuth2 \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.pdf" "b/doc/\345\237\272\344\272\216 OAuth2 \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.pdf"
new file mode 100644
index 0000000..0963f6c
--- /dev/null
+++ "b/doc/\345\237\272\344\272\216 OAuth2 \350\256\244\350\257\201\347\232\204\350\265\204\346\272\220\346\216\245\345\217\243\350\257\267\346\261\202\346\226\271\345\274\217.pdf"
Binary files differ