mirror of
https://gitee.com/dromara/sa-token.git
synced 2026-05-14 04:42:09 +08:00
docs: 图片地址更换为本地文件 (OAuth2篇)
This commit is contained in:
@@ -33,7 +33,7 @@ public class SaOAuth2DataLoaderImpl implements SaOAuth2DataLoader {
|
||||
|
||||
当不知情的小红被诱导访问了这个 URL 时,它将被重定向至百度首页。
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/oauth2-ticket-jc.png" alt="oauth2-ticket-jc" />
|
||||
|
||||
可以看到,代表着用户身份的 code 授权码也显现到了URL之中,借此漏洞,攻击者完全可以构建一个 URL 将小红的 code 授权码自动提交到攻击者自己的服务器,伪造小红身份登录网站。
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SaOAuth2DataLoaderImpl implements SaOAuth2DataLoader {
|
||||
|
||||
再次访问上述链接:
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/oauth2-feifa-rf.png" alt="oauth2-feifa-rf" />
|
||||
|
||||
URL 没有通过校验,拒绝授权!
|
||||
|
||||
|
||||
@@ -117,11 +117,11 @@ public class SaOAuth2ServerH5Controller {
|
||||
|
||||
在前端 ide 中导入 demo 案例的 `sa-token-demo-oauth2-server-h5` 项目,然后直接预览 `oauth2-authorize.html` 页面,如图所示:
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/sa-oauth2-server-authorize-h5.png" alt="sa-oauth2-server-authorize-h5.png" />
|
||||
|
||||
复制上述地址,然后将其配置到 “OAuth2前端测试页” 的 “OAuth2 Server 授权页地址” 选项中,其它选项保持默认不变:
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/sa-oauth2-client-test-h5-page-setting.png" alt="sa-oauth2-client-test-h5-page-setting.png" />
|
||||
|
||||
然后根据 “OAuth2前端测试页” 的页面提示进行测试即可,此处不再赘述。
|
||||
|
||||
|
||||
@@ -227,14 +227,14 @@ http://sa-oauth-server.com:8000/oauth2/authorize?response_type=code&client_id=10
|
||||
|
||||
2、由于首次访问,我们在OAuth-Server端暂未登录,会被转发到登录视图
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/sa-oauth2-server-login-view--v43.png" alt="sa-oauth2-server-login-view" />
|
||||
|
||||
3、输入 `sa/123456` 进行登录之后,会提示我们确认授权
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/sa-oauth2-server-scope.png" alt="sa-oauth2-server-scope" />
|
||||
|
||||
4、点击同意授权之后,我们会被重定向至 redirect_uri 页面,并携带了code参数
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/sa-oauth2-server-code.png" alt="sa-oauth2-server-code" />
|
||||
|
||||
4、我们拿着code参数,访问以下地址:
|
||||
``` url
|
||||
@@ -272,7 +272,7 @@ http://sa-oauth-server.com:8000/oauth2/token?grant_type=authorization_code&clien
|
||||
|
||||
依次启动`OAuth2-Server` 与 `OAuth2-Client`,然后从浏览器访问:[http://sa-oauth-client.com:8002](http://sa-oauth-client.com:8002)
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/sa-oauth2-client-index.png" alt="sa-oauth2-client-index" />
|
||||
|
||||
如图,可以针对OAuth2.0四种模式进行详细测试
|
||||
|
||||
@@ -286,7 +286,7 @@ OAuth2 前端测试页:
|
||||
|
||||
此示例允许你在前端自由配置 OAuth-Client 端所需的各个参数,方便对 OAuth2 四种模式的测试。
|
||||
|
||||

|
||||
<img class="s-w-sh" src="/big-file/doc/oauth2-new/sa-oauth2-client-test-h5-page.png" alt="sa-oauth2-client-index" />
|
||||
|
||||
<p><a class="case-btn case-btn-video" href="https://www.bilibili.com/video/BV13LSMYzEmE/" target="_blank">
|
||||
参考视频:OAuth2 四种模式 前端测试页
|
||||
|
||||
@@ -23,7 +23,7 @@ OAuth2.0 与 SSO 相比,增加了对应用授权范围的控制,减弱了应
|
||||
3. 密码式(Password):Client 端直接拿着用户的账号密码换取授权 `Access-Token`。
|
||||
4. 客户端凭证(Client Credentials):Server 端针对 Client 级别的 Token,代表应用自身的资源授权。
|
||||
|
||||

|
||||
<img src="/big-file/doc/oauth2-new/sa-oauth2-setup.png" alt="sa-oauth2-setup.png" />
|
||||
|
||||
接下来我们将通过简单示例演示如何在 Sa-Token-OAuth2 中完成这四种模式的对接: [搭建OAuth2-Server](/oauth2/oauth2-server)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user