简体   繁体   中英

How to implement custom login/logout (Authentication) inside Spring MVC when you have separate Auth Server which user Password Grant

I am currently working on a Spring MVC web application which calls separate AuthServer (resource owner password credentials). My question is it ok for the Spring MVC web app to implement and handle its own login interface while it needs to be integrated with the separate AuthServer. Any idea on how to handle it using Spring Security? I wonder if is it possible to put authentication (OAuth password grant) in WebSecurityConfigurerAdapter. BTW, AuthServer is on the same server but different application, not on a separate server like Facebook or Google AuthServer. I have done my research but did not found an answer on the possibility. Hope someone could help me on this. Thanks in advance.

I have implemented such a thing. I am not sure if this is the best way to do it, but it is maybe the fastest. So in the WebSecurityConfigurerAdapter - authenticate method - just work with your other authorization server and handle the exceptions there- you can wrap the other server responses and exceptions with your own corresponding to your structure. That worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM