Java Code Examples for me.zhyd.oauth.request.AuthRequest#revoke()

The following examples show how to use me.zhyd.oauth.request.AuthRequest#revoke() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OAuthController.java    From OneBlog with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 收回授权
 *
 * @param source
 * @param token
 * @return
 * @throws IOException
 */
@RequestMapping("/revoke/{source}/{token}")
public ModelAndView revokeAuth(@PathVariable("source") String source, @PathVariable("token") String token) throws IOException {
    AuthRequest authRequest = RequestFactory.getInstance(source).getRequest();
    AuthResponse response = authRequest.revoke(AuthToken.builder().accessToken(token).build());
    if (response.getCode() == 2000) {
        return ResultUtil.redirect("/");
    }
    return ResultUtil.redirect("/login");
}
 
Example 2
Source File: AuthRestApi.java    From mogu_blog_v2 with Apache License 2.0 4 votes vote down vote up
@RequestMapping("/revoke/{source}/{token}")
public Object revokeAuth(@PathVariable("source") String source, @PathVariable("token") String token) throws IOException {
    AuthRequest authRequest = getAuthRequest(source);
    return authRequest.revoke(AuthToken.builder().accessToken(token).build());
}