SpringBoot整合SpringSecurityOauth2实现鉴权
SpringBoot整合SpringSecurityOauth2實(shí)現(xiàn)鑒權(quán)-動(dòng)態(tài)權(quán)限
寫(xiě)在前面
思考:為什么需要鑒權(quán)呢?
系統(tǒng)開(kāi)發(fā)好上線(xiàn)后,API接口會(huì)暴露在互聯(lián)網(wǎng)上會(huì)存在一定的安全風(fēng)險(xiǎn),例如 :爬蟲(chóng)、惡意訪(fǎng)問(wèn)等。因此,我們需要對(duì)非開(kāi)放API接口進(jìn)行用戶(hù)鑒權(quán) ,鑒權(quán)通過(guò)之后再允許調(diào)用 。
準(zhǔn)備
spring-boot:2.1.4.RELEASE
spring-security-oauth2 :2.3.3.RELEASE(如果要使用源碼,不要隨意改動(dòng)這個(gè)版本號(hào)