I based on the framework of the use of OAuth2.0 summary, drawing a user name + password to achieve OAuth2.0 login certification flowchart, today we look at the logout process:
/** * User logoff * @param accesstoken * @return */@RequestMapping (value = "/user/logout", Metho D = requestmethod.post) public Responsevo userlogout (@RequestHeader (value = "Accesstoken", required = true) String access Token, @RequestHeader (value = "userid", required = True) Long userId) throws exception{Oauthaccesstoken Oauthac Cesstoken = Usermgrservice.getoauthaccesstoken (Accesstoken); if (null = = Oauthaccesstoken) {return Userresponsecode.buildenumresponsevo (Userresponsecode.response_code_oauth_ac Cesstoken_empty, NULL); }//Delete oauthtoken record Boolean result = Usermgrservice.revokeoauthtoken (Oauthaccesstoken); if (result) {return Userresponsecode.buildenumresponsevo (userresponsecode.response_return_code_success, NULL); } return Userresponsecode.buildenumresponsevo (Userresponsecode.response_code_system_error, NULL); }
I'm just writing some of the code out here, and we'll post all the code in detail for your reference, from creating a database to every process that executes it. From now on, I will be documenting the process and essence of the recent development of the spring cloud micro-service cloud architecture to help more friends who are interested in developing the Spring cloud framework to explore the process of building the spring cloud architecture and how to use it in enterprise projects.
Integrate spring Cloud Cloud architecture-SSO Single Sign-on OAuth2.0 logout process (3)