Bladex-Boot使用Postman調用服務說明

一:GitBladex-Boot項目,並啓動服務數據庫

二:打開Postman測試

三:使用Post,調用http://localhost/blade-auth/oauth/token/網站

配置:Header中增長Key:Authorization ,VALUE:Basic c2FiZXI6c2FiZXJfc2VjcmV0(注:"c3dvcmQ6c3dvcmRfc2VjcmV0"爲clientId:clientSecret串轉換爲的base64編碼,這個是可變的,clientId:clientSecret的取值在Bladex數據庫中的blade_client表中的client_id字段的值和client_secret字段的值中間用冒號鏈接轉爲Base64位編碼便可,Base64編碼網站:http://tool.oschina.net/encrypt?type=3編碼

如:.net

client_id:saber3d

client_secret:saber_secretcode

clientId:clientSecret組合爲:saber:saber_secret  [注意冒號爲半角字符]token

通過Base64編碼後爲:c2FiZXI6c2FiZXJfc2VjcmV0接口

ci

Body中增長:

Key:usernaem,VALUE:admin

Key:password,VALUE:admin

Key:tenantId,VALUE:000000

四:從返回的Json中取到 tokenType 和 accessToken,將他們拼接起來並以空格隔開

返回JSON中的內容以下:

"access_token": "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1c2VyIiwiYXVkIjoiYXVkaWVuY2UiLCJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJyb2xlX25hbWUiOiJhZG1pbmlzdHJhdG9yIiwidXNlcl9pZCI6IjExMjM1OTg4MjE3Mzg2NzUyMDEiLCJyb2xlX2lkIjoiMTEyMzU5ODgxNjczODY3NTIwMSIsInVzZXJfbmFtZSI6ImFkbWluIiwibmlja19uYW1lIjoi566h55CG5ZGYIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsImRlcHRfaWQiOiIxMTIzNTk4ODEzNzM4Njc1MjAxIiwiYWNjb3VudCI6ImFkbWluIiwiY2xpZW50X2lkIjoic3dvcmQiLCJleHAiOjE1Njg5NTYxMjUsIm5iZiI6MTU2ODk1MjUyNX0.ossjztnl8vPu1anZVvikNlxlaR7I4U8Puo9evRtRfD0",
"token_type": "bearer",
拼接好後以下:
 
bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1c2VyIiwiYXVkIjoiYXVkaWVuY2UiLCJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJyb2xlX25hbWUiOiJhZG1pbmlzdHJhdG9yIiwidXNlcl9pZCI6IjExMjM1OTg4MjE3Mzg2NzUyMDEiLCJyb2xlX2lkIjoiMTEyMzU5ODgxNjczODY3NTIwMSIsInVzZXJfbmFtZSI6ImFkbWluIiwibmlja19uYW1lIjoi566h55CG5ZGYIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsImRlcHRfaWQiOiIxMTIzNTk4ODEzNzM4Njc1MjAxIiwiYWNjb3VudCI6ImFkbWluIiwiY2xpZW50X2lkIjoic3dvcmQiLCJleHAiOjE1Njg5NTYxMjUsIm5iZiI6MTU2ODk1MjUyNX0.ossjztnl8vPu1anZVvikNlxlaR7I4U8Puo9evRtRfD0

五:其它API的調用,須要設置請求頭爲blade-auth,請求頭對應的值爲第四點拼接好的字符串 (後續的全部接口調用都須要帶上請求頭爲 Authorization 值爲 c3dvcmQ6c3dvcmRfc2VjcmV0,【受權認證時須要,後續接口經測試,不用須要增加】)

六:其它接口測試:http://localhost/blade-employee/list?current=1&size=10

配置:

Header中增長

Key:blade-auth

VALUE:bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1c2VyIiwiYXVkIjoiYXVkaWVuY2UiLCJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJyb2xlX25hbWUiOiJhZG1pbmlzdHJhdG9yIiwidXNlcl9pZCI6IjExMjM1OTg4MjE3Mzg2NzUyMDEiLCJyb2xlX2lkIjoiMTEyMzU5ODgxNjczODY3NTIwMSIsInVzZXJfbmFtZSI6ImFkbWluIiwibmlja19uYW1lIjoi566h55CG5ZGYIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsImRlcHRfaWQiOiIxMTIzNTk4ODEzNzM4Njc1MjAxIiwiYWNjb3VudCI6ImFkbWluIiwiY2xpZW50X2lkIjoic3dvcmQiLCJleHAiOjE1Njg5NTYxMjUsIm5iZiI6MTU2ODk1MjUyNX0.ossjztnl8vPu1anZVvikNlxlaR7I4U8Puo9evRtRfD0

Body中增長:

Key:username

VALUE:admin

Key:password

VALUE:admin

【Send】便可調用成功

相關文章
相關標籤/搜索