Oauth2的遇坑一點提示(Spring Security Oauth2 / Cloud)


1)使用@EnableOAuth2Sso的網頁客戶端,登錄是成功的可是總是像沒成功一樣。

    提示錯誤:沒有

    症結:context-path沒設置,或者設置為/(ROOT)

  參考資料:https://spring.io/guides/tutorials/spring-boot-oauth2/#_social_login_simple

  

  簡單說就是服務器和客戶機都在localhost上時,cookie會區分不了。。

 

2)認證服務器,跳轉授權都沒問題,但是token就是沒法取,不是401就是莫名其妙出先一個登錄頁面。(舊版沒發現,在GreenWich/boot 2.1.4上發現的)

  提示錯誤:WARN- Encoded password does not look like BCrypt

  症結:client_secret需要BCrypt加密。(舊版可以不加密)

  例如:withClient("client1").secret(passwordEncoder.encode("secret1"))

  參考資料:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide

                         https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/spring-boot-features.html#boot-features-security-oauth2

       https://docs.spring.io/spring-security-oauth2-boot/docs/current/reference/htmlsingle/

       https://blog.csdn.net/m0_37834471/article/details/81162121?utm_source=blogxgwz5

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM