中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

網(wǎng)站建設(shè)免費書廣東知名seo推廣多少錢

網(wǎng)站建設(shè)免費書,廣東知名seo推廣多少錢,網(wǎng)站建設(shè)怎么引流,字節(jié)跳動直播開放平臺Hi Auth HiAuth是一個開源的基于Oauth2協(xié)議的認(rèn)證、授權(quán)系統(tǒng),除了標(biāo)準(zhǔn)的Oauth2授權(quán)流程功能外,還提供了應(yīng)用管理、用戶管理、權(quán)限管理等相關(guān)功能。 在這個項目中你能夠了解到如何基于spring-security-oauth2-authorization-server實現(xiàn)自己的Authorizat…

Hi Auth

HiAuth是一個開源的基于Oauth2協(xié)議的認(rèn)證、授權(quán)系統(tǒng),除了標(biāo)準(zhǔn)的Oauth2授權(quán)流程功能外,還提供了應(yīng)用管理、用戶管理、權(quán)限管理等相關(guān)功能。

在這個項目中你能夠了解到如何基于spring-security-oauth2-authorization-server實現(xiàn)自己的Authorization Server 認(rèn)證服務(wù)、資源服務(wù)器以及如何第三方集成,本項目基于SpringBoot 3.0 版本開發(fā)。

項目源碼地址:https://github.com/bestaone/HiAuth

介紹

除了認(rèn)證相關(guān)功能外,還提供了hiauth-mall、hiauth-mgr-svc項目,供用戶參考如何集成。

  • 參考hiauth-mall,你可以了解如何在第三方應(yīng)用中集成hiauth授權(quán)服務(wù);
  • 參考hiauth-mgr-svc項目,你可以快速的啟動一個微服務(wù)項目的框架搭建,亦可以在這里找到一些技術(shù)的最佳實踐,為你的項目開發(fā)提供參考;

HiAuth 2.0 升級到 3.0 的升級內(nèi)容

  • SpringBoot 3.0.2
  • spring-security-oauth2-authorization-server 1.0.0
  • mybatis-plus 3.5.3.1

調(diào)整比較大的地方

  • SpringSecurity升級到6.0版本后,用法有不少改動
  • SpringSecurity5以后已不再支持Authorization Server,取而代之的事spring-security-oauth2-authorization-server 項目
  • 前端從vue-element-admin換成了AntDesignPro

如果你覺得此項目有價值,請給我點個star,謝謝!

項目地址:https://github.com/bestaone/HiAuth

目錄結(jié)構(gòu)

├─doc                  文檔目錄,架構(gòu)設(shè)計、數(shù)據(jù)庫設(shè)計...
├─cicd                 持續(xù)集成相關(guān)腳本
├─hiauth-parent        統(tǒng)一管理依賴(必選)
├─hiauth-server        hiauth認(rèn)證服務(wù)(必選)
├─hiauth-resource      hiauth資源管理服務(wù),參考如何集成資源服務(wù)(參考)
├─hiauth-himall        himall是一個demo,參考此項目了解如何集成hiauth(參考)
├─hiauth-mgr-svc       hiauth管理端后臺服務(wù),基于SpringBoot(可選)
├─hiauth-mgr-fornt     hiauth管理端前端代碼,基于AntDesignPro(可選)

功能

  • 這個項目可以幫你實現(xiàn)基于Oauth2協(xié)議的統(tǒng)一認(rèn)證、授權(quán)系統(tǒng);
  • 這個項目可以幫助你快速的啟動一個基于SpringBoot技術(shù)棧的微服務(wù)框架搭建;
  • 如果你僅僅使用到了Oauth2協(xié)議的統(tǒng)一認(rèn)證、授權(quán)系統(tǒng)功能,那么你用技術(shù)可以是除java外的技術(shù)棧;
  • himall演示了authorization_code模式,HiAuth支持了用戶名密碼、手機號短信兩種認(rèn)證方式;
  • 發(fā)送短信、登錄接口實現(xiàn)了圖形驗證碼防刷功能;
  • HiAuth是一個前后端分離項目,前端使用了React、AntDesign技術(shù),參考這個項目,你可以自定義開發(fā)管理后端;
  • 基于SpringBoot項目更容易集成到多個平臺(SpringCloud、K8S、Istio);
  • 演示了如何統(tǒng)一控制接口規(guī)范;
  • 演示了如何規(guī)范異常處理;
  • 演示了如何規(guī)范使用MyBaits-Plus、分頁;
  • 演示了單元測試、mock測試、測試數(shù)據(jù)回滾,包括對controller、service的測試;

截圖

  • HiMall

  • UMC

前端從vue-element-admin換成了AntDesignPro截圖還沒來得及做新的

LIVE DEMO

  • Hiauth HiMall:http://himall.hiauth.cn
  • Hiauth Manger:http://mgr.hiauth.cn
  • Hiauth Server:http://auth.hiauth.cn

快速啟動

環(huán)境需求

  • JDK17+
  • Maven 3.8.6
  • MySQL 8
  • Redis
  • NodeJS v16+(<v18)
  • Yarn 1.22.4

下載源碼

>git clone https://github.com/bestaone/HiAuth.git

創(chuàng)建數(shù)據(jù)庫

在你的mysql數(shù)據(jù)庫中創(chuàng)建庫hiauth,并執(zhí)行下面腳本:

> HiAuth\doc\hiauth.sql# 也可以從JAR自己提取相關(guān)表結(jié)構(gòu)
# org.springframework.security.oauth2.server.authorization.client/oauth2-registered-client-schema.sql
# org.springframework.security.oauth2.server.authorization/oauth2-authorization-consent-schema.sql
# org.springframework.security.oauth2.server.authorization/oauth2-authorization-schema.sql

調(diào)整配置

需要調(diào)整的配置有數(shù)據(jù)庫、redis,默認(rèn)會使用native.properties配置,如果和你的環(huán)境不一致。

請修改:

# 需要將如下兩個文件中的mysql、redis的配置改成自己的
# HiAuth\hiauth-server\src\main\properties\native.properties
# HiAuth\hiauth-mgr-svc\src\main\properties\native.propertiesapp.host=http://127.0.0.1:8080database.url=jdbc:mysql://mysql-server:3306/hiauth3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
database.username=dev
database.password=123456redis.host=redis-server
redis.port=6379
redis.database=8
redis.password=

添加host

# IP 換成你自己的
127.0.0.1 redis-server
127.0.0.1 mysql-server

構(gòu)建、啟動

# 編譯后臺,會執(zhí)行單元測試,需要正確配置數(shù)據(jù)庫和redis
>cd HiAuth
>mvn clean install# 構(gòu)建前端并啟動
>cd HiAuth\hiauth-mgr-front
>yarn install
>yarn start# 啟動hiauth授權(quán)服務(wù)端
>cd HiAuth\hiauth-server
>mvn spring-boot:run# 啟動hiauth資源服務(wù)端
>cd HiAuth\hiauth-resource
>mvn spring-boot:run# 啟動himall
>cd HiAuth\hiauth-himall
>mvn spring-boot:run# 啟動hiauth管理后端
>cd HiAuth\hiauth-mgr-svc
>mvn spring-boot:run

驗證

驗證登錄

  • 訪問HiMall:http://127.0.0.1:8081
  • 訪問Server:http://127.0.0.1:8080
  • 訪問Manager:http://127.0.0.1:8080 (具體端口看前端項目啟動后的控制臺輸出)

驗證Swagger

  • 訪問HiAuth的Swagger地址:http://127.0.0.1:8080/swagger-ui.html
  • 直接測試接口,顯示未認(rèn)證
{"error": "unauthorized","error_description": "Full authentication is required to access this resource"
}
  • 點擊認(rèn)證按鈕,會被重定向到登錄,輸入賬號登錄進行認(rèn)證
  • 認(rèn)證成功后被重定向回swagger頁面
  • 再次測試接口,獲取正確數(shù)據(jù)

驗證Oauth2流程

authorization_code 認(rèn)證流程

  • 在瀏覽器中輸入如下地址,會調(diào)到登錄頁,登錄完成后會跳轉(zhuǎn)到百度,在瀏覽器url中把code碼復(fù)制出來
http://127.0.0.1:8080/oauth2/authorize?client_id=demo-client-id&response_type=code&scope=user_info&redirect_uri=http://www.baidu.com
  • 使用上面獲取的code換取accessToken
curl --location --request POST 'http://127.0.0.1:8080/oauth2/token?grant_type=authorization_code&code=code&redirect_uri=http://www.baidu.com' \--header 'Authorization: Basic ZGVtby1jbGllbnQtaWQ6ZGVtby1jbGllbnQtc2VjcmV0'
{"access_token": "xxxxxx","refresh_token": "yyyyy","scope": "user_info","token_type": "Bearer","expires_in": 7199
}

Authorization = Basic base64.encode(client_id:client_secret)可以在網(wǎng)上找個在線工具生成,或者直接用postman測試,Authorization選擇Basic Auth,填入對應(yīng)值即可

  • 訪問受控接口,不帶accessToken,返回401,未授權(quán)
>curl --location --request POST 'http://127.0.0.1:8082/user/info'
{"error": "unauthorized","error_description": "Full authentication is required to access this resource"
}
  • 訪問受控接口,攜帶accessToken,返回數(shù)據(jù)
curl --location --request POST 'http://127.0.0.1:8082/user/info' --header 'Authorization: Bearer token'
{"name":"Resource"
}

refresh_token

curl --location --request POST 'http://127.0.0.1:8080/oauth2/token?grant_type=refresh_token&refresh_token=refresh_token' \--header 'Authorization: Basic ZGVtby1jbGllbnQtaWQ6ZGVtby1jbGllbnQtc2VjcmV0'
{"access_token": "xxxxxx","refresh_token": "yyyyy","scope": "user_info","token_type": "Bearer","expires_in": 6152
}
client_credentials 認(rèn)證流程
  • 使用POST訪問獲取access_token接口,設(shè)置grant_type=client_credentials
curl --location --request POST 'http://127.0.0.1:8080/oauth2/token?grant_type=client_credentials&scope=user_info' \--header 'Authorization: Basic ZGVtby1jbGllbnQtaWQ6ZGVtby1jbGllbnQtc2VjcmV0'
{"access_token": "xxxxxx","scope": "user_info","token_type": "Bearer","expires_in": 7199
}
scop權(quán)限范圍驗證
  • 使用POST訪問獲取access_token接口,設(shè)置grant_type=client_credentialsscope=message.read
> curl --location --request POST 'http://127.0.0.1:8080/oauth2/token?grant_type=client_credentials&scope=message.read' --header 'Authorization: Basic ZGVtby1jbGllbnQtaWQ6ZGVtby1jbGllbnQtc2VjcmV0'
# 返回的 token 的權(quán)限范圍是 message.read
{"access_token": "xxxxxx","scope": "message.read","token_type": "Bearer","expires_in": 7199
}
  • 使用擁有message.read權(quán)限的toke訪問用戶接口,被拒絕,提示無權(quán)限
curl --location --request POST 'http://127.0.0.1:8082/user/info' --header 'Authorization: Bearer token'
{"error": "insufficient_scope","error_description": "Insufficient scope for this resource","scope": "user_info"
}

所有的127.0.0.1不能使用localhost代替,因為auth會檢查域名的合法性,數(shù)據(jù)庫中登記的是127.0.0.1

集成認(rèn)證、授權(quán)服務(wù)

這里為了演示如何集成HiAuth、提供了一個Demo項目HiMall。

HiMall

HiMall是基于SpringBoot技術(shù)的微服務(wù)項目,其集成了HiAuth的認(rèn)證、授權(quán)。

環(huán)境需求

  • JDK17+
  • HiAuth3

安裝、啟動

#編譯、構(gòu)建項目
>cd HiAuth\hiaut-himall
>mvn clean install
>mvn spring-boot:run

驗證authorization_code模式認(rèn)證

  • 訪問地址:http://127.0.0.1:8081
  • 點擊Login,會被重定向到HiAuth系統(tǒng)進行認(rèn)證
  • 認(rèn)證通過后會被重定向回HiMall,此時HiMall也將持有登錄狀態(tài)

授權(quán)協(xié)議

本項目執(zhí)行 MIT 協(xié)議

社區(qū)與作者

如果群二維碼失效了,請先添加我的微信,然我我拉你入群。

http://www.risenshineclean.com/news/8897.html

相關(guān)文章:

  • 百度付費推廣seo公司上海
  • 公司注銷網(wǎng)站備案申請表網(wǎng)站推廣和優(yōu)化系統(tǒng)
  • 自己買一臺服務(wù)器做自己的網(wǎng)站市場seo是什么
  • 建設(shè)項目社會招標(biāo)上那個網(wǎng)站網(wǎng)絡(luò)推廣哪個平臺效果最好
  • 平安建設(shè)宣傳音頻免費下載網(wǎng)站微網(wǎng)站建站平臺
  • 網(wǎng)站建設(shè)后期服務(wù)收費標(biāo)準(zhǔn)口碑營銷的成功案例
  • 網(wǎng)站建設(shè)業(yè)務(wù)員論壇漳州seo網(wǎng)站快速排名
  • 可以做pos機的網(wǎng)站關(guān)鍵詞排名怎么查
  • tripod wordpressseo免費課程視頻
  • 如何做自助網(wǎng)站百度如何收錄網(wǎng)站
  • 沈陽建設(shè)工程信息網(wǎng) 最佳中項網(wǎng)公眾號seo排名優(yōu)化
  • 網(wǎng)絡(luò)服務(wù)器設(shè)備福清市百度seo
  • 國家企業(yè)信用信息公示網(wǎng)官網(wǎng)查詢seo平臺有哪些
  • 網(wǎng)站建設(shè)饣金手指科杰十二西安百度
  • 十大黃臺軟件app下載如何提高搜索引擎優(yōu)化
  • css怎么做響應(yīng)式網(wǎng)站排名優(yōu)化外包公司
  • 凡科建站的怎么取消手機網(wǎng)站怎樣建立自己的網(wǎng)站平臺
  • 哪些網(wǎng)站可以做ppt賺錢域名注冊網(wǎng)
  • stanley工具網(wǎng)站開發(fā)品牌策略
  • 室內(nèi)設(shè)計學(xué)校排行榜合肥正規(guī)的seo公司
  • 英文版網(wǎng)站案例廣州營銷課程培訓(xùn)班
  • 根據(jù)網(wǎng)站日志做seoseo就業(yè)前景
  • 醫(yī)院網(wǎng)站建設(shè)情況百度競價是什么意思?
  • 免費營銷網(wǎng)站制作模板搜索引擎的網(wǎng)址有哪些
  • 溫江建網(wǎng)站免費推廣網(wǎng)站有哪些
  • 三五互聯(lián)做網(wǎng)站嗎如何進行品牌宣傳與推廣
  • 國外免費建站腦白金網(wǎng)絡(luò)營銷
  • 武漢品牌網(wǎng)站設(shè)計海外發(fā)布新聞
  • 池州網(wǎng)站建設(shè)開發(fā)合肥網(wǎng)絡(luò)推廣優(yōu)化公司
  • 云南網(wǎng)站制作公司搜索引擎優(yōu)化需要多少錢