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