diff --git a/README.md b/README.md index 8f251a1..b91a6f3 100644 --- a/README.md +++ b/README.md @@ -482,45 +482,71 @@ public Authentication attemptAuthentication(HttpServletRequest request, HttpServ } ``` + + ## postman接口测试截图 -> 注意:postman的Authorization有几种方式,这里主要用到Basic的, -实际请求会在其请求头加上一个字段名为Authorization,值为:Basic eWFvaHc6eWFvaHc=,这后面的其实是yaohw:yaohw,经过base64加密了一下, -携带token的请求要求在请求头加上一个字段名为Authorization,值为Bearer accessToken。 -授权码模式第一步和简化模式返回的是一个认证页面,登录后会回调(填的回调地址),并在回调参数返回code或accessToken。 ### 客户端Basic请求头 -![image](./images/客户端请求头.png "客户端请求头") +这里两种方式都是一样的,eWFvaHc6eWFvaHc=其实就是yaohw:yaohw,经过base64加密了一下 + +![image](https://poile-img.nos-eastchina1.126.net/oauth2/Basic.png) -### 请求头携带token -![image](./images/携带token.png "携带token") + +![](https://poile-img.nos-eastchina1.126.net/oauth2/Basic-2.png) ### 密码模式 -![image](./images/密码模式_01.png "密码模式") +![image](https://poile-img.nos-eastchina1.126.net/oauth2/password.png) ### 自定义手机号验证码模式 > 注意:需要在redis中设置一个缓存,String类型,key为sms:code:你的手机号,值为短信验证码 -![image](./images/验证码.png "redis存储的验证码") +![image](https://poile-img.nos-eastchina1.126.net/oauth2/cache.png) + -![image](./images/自定义模式_01.png "自定义模式") + +![image](https://poile-img.nos-eastchina1.126.net/oauth2/mobile.png) ### 授权码模式 ##### 授权码模式步骤一 授权码模式步骤一 会跳转到认证中心的授权页面,这里为方便展示参数才用postman,get请求,应在浏览器直接打开(带对应参数),授权成功后会回调回调地址,并且会携带code。 -![image](./images/授权码模式_01.png "授权码模式步骤一") +![image](https://poile-img.nos-eastchina1.126.net/oauth2/code-1.png) + +##### 授权码模式步骤二(授权页面授权) + +![image](https://poile-img.nos-eastchina1.126.net/oauth2/code-2.png) + +### 授权码模式步骤三(获取code) + +![](https://poile-img.nos-eastchina1.126.net/oauth2/code-3.png) -##### 授权码模式步骤二 -![image](./images/授权码模式_02.png "授权码模式步骤二") + +### 授权码模式步骤四(根据code获取token) + +![](https://poile-img.nos-eastchina1.126.net/oauth2/code-4.png) ### 简化模式 -与授权码模式类似,不过回调后携带的参数不是code,还是access_token,比授权码模式少了一步。 -![image](./images/简化模式_01.png "简化") +与授权码模式类似,不过回调后携带的参数不是code,还是access_token,比授权码模式少了一步. + +### 步骤一 + +简化模式步骤一会跳转到认证中心的授权页面,这里为方便展示参数才用postman,get请求,应在浏览器直接打开(带对应参数),授权成功后会回调回调地址,并且会携带accessToken。 + +![image](https://poile-img.nos-eastchina1.126.net/oauth2/%20implicit.png) + +##### 步骤二(授权页面授权) + +![image](https://poile-img.nos-eastchina1.126.net/oauth2/code-2.png) + +### 步骤三 + +![](https://poile-img.nos-eastchina1.126.net/oauth2/%20Implicit-2.png) + ### 刷新token模式 -![image](./images/刷新token.png "刷新") +![image](https://poile-img.nos-eastchina1.126.net/oauth2/refresh-token.png) diff --git a/images/ Implicit-2.png b/images/ Implicit-2.png new file mode 100644 index 0000000..68c3883 Binary files /dev/null and b/images/ Implicit-2.png differ diff --git a/images/ implicit.png b/images/ implicit.png new file mode 100644 index 0000000..36cc650 Binary files /dev/null and b/images/ implicit.png differ diff --git a/images/AuthorizationCode_01.png b/images/AuthorizationCode_01.png deleted file mode 100644 index 4424504..0000000 Binary files a/images/AuthorizationCode_01.png and /dev/null differ diff --git a/images/Basic-2.png b/images/Basic-2.png new file mode 100644 index 0000000..5110e77 Binary files /dev/null and b/images/Basic-2.png differ diff --git a/images/Basic.png b/images/Basic.png new file mode 100644 index 0000000..c8c4413 Binary files /dev/null and b/images/Basic.png differ diff --git a/images/cache.png b/images/cache.png new file mode 100644 index 0000000..6d82f76 Binary files /dev/null and b/images/cache.png differ diff --git a/images/code-1.png b/images/code-1.png new file mode 100644 index 0000000..624792c Binary files /dev/null and b/images/code-1.png differ diff --git a/images/code-2.png b/images/code-2.png new file mode 100644 index 0000000..9bedc3b Binary files /dev/null and b/images/code-2.png differ diff --git a/images/code-3.png b/images/code-3.png new file mode 100644 index 0000000..8c34ccf Binary files /dev/null and b/images/code-3.png differ diff --git a/images/code-4.png b/images/code-4.png new file mode 100644 index 0000000..750612b Binary files /dev/null and b/images/code-4.png differ diff --git a/images/mobile.png b/images/mobile.png new file mode 100644 index 0000000..a277c87 Binary files /dev/null and b/images/mobile.png differ diff --git a/images/password.png b/images/password.png new file mode 100644 index 0000000..f51851c Binary files /dev/null and b/images/password.png differ diff --git a/images/refresh-token.png b/images/refresh-token.png new file mode 100644 index 0000000..8f56d11 Binary files /dev/null and b/images/refresh-token.png differ diff --git "a/images/\345\210\267\346\226\260token.png" "b/images/\345\210\267\346\226\260token.png" deleted file mode 100644 index 262c98e..0000000 Binary files "a/images/\345\210\267\346\226\260token.png" and /dev/null differ diff --git "a/images/\345\256\242\346\210\267\347\253\257\350\257\267\346\261\202\345\244\264.png" "b/images/\345\256\242\346\210\267\347\253\257\350\257\267\346\261\202\345\244\264.png" deleted file mode 100644 index 6c043c0..0000000 Binary files "a/images/\345\256\242\346\210\267\347\253\257\350\257\267\346\261\202\345\244\264.png" and /dev/null differ diff --git "a/images/\345\257\206\347\240\201\346\250\241\345\274\217_01.png" "b/images/\345\257\206\347\240\201\346\250\241\345\274\217_01.png" deleted file mode 100644 index 4bedcd1..0000000 Binary files "a/images/\345\257\206\347\240\201\346\250\241\345\274\217_01.png" and /dev/null differ diff --git "a/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_01.png" "b/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_01.png" deleted file mode 100644 index 3288606..0000000 Binary files "a/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_01.png" and /dev/null differ diff --git "a/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_02.png" "b/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_02.png" deleted file mode 100644 index 0181367..0000000 Binary files "a/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_02.png" and /dev/null differ diff --git "a/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_03.png" "b/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_03.png" deleted file mode 100644 index 7e10e1d..0000000 Binary files "a/images/\346\216\210\346\235\203\347\240\201\346\250\241\345\274\217_03.png" and /dev/null differ diff --git "a/images/\346\220\272\345\270\246token.png" "b/images/\346\220\272\345\270\246token.png" deleted file mode 100644 index 536890a..0000000 Binary files "a/images/\346\220\272\345\270\246token.png" and /dev/null differ diff --git "a/images/\347\256\200\345\214\226\346\250\241\345\274\217_01.png" "b/images/\347\256\200\345\214\226\346\250\241\345\274\217_01.png" deleted file mode 100644 index a628794..0000000 Binary files "a/images/\347\256\200\345\214\226\346\250\241\345\274\217_01.png" and /dev/null differ diff --git "a/images/\350\207\252\345\256\232\344\271\211\346\250\241\345\274\217_01.png" "b/images/\350\207\252\345\256\232\344\271\211\346\250\241\345\274\217_01.png" deleted file mode 100644 index 7cdf11c..0000000 Binary files "a/images/\350\207\252\345\256\232\344\271\211\346\250\241\345\274\217_01.png" and /dev/null differ diff --git "a/images/\351\252\214\350\257\201\347\240\201.png" "b/images/\351\252\214\350\257\201\347\240\201.png" deleted file mode 100644 index 3edfafb..0000000 Binary files "a/images/\351\252\214\350\257\201\347\240\201.png" and /dev/null differ