赞
踩
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
第三方登陆端点
@author tarzan
*/
@RestController
@AllArgsConstructor
@RequestMapping(“auth”)
@ConditionalOnProperty(value = “social.enabled”, havingValue = “true”)
@Api(value = “第三方登陆”, tags = “第三方登陆端点”)
public class BladeSocialEndpoint {
private final SocialProperties socialProperties;
/**
*/
@ApiOperation(value = “授权完毕跳转(RequestMapping)”)
@RequestMapping(“/oauth/render/{source}”)
public void renderAuth(@PathVariable(“source”) String source, HttpServletResponse response) throws IOException {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
response.sendRedirect(authorizeUrl);
}
/**
*/
@ApiOperation(value = “获取认证信息(RequestMapping)”)
@RequestMapping(“/oauth/callback/{source}”)
public Object login(@PathVariable(“source”) String source, AuthCallback callback) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
return authRequest.login(callback);
}
/**
*/
@ApiOperation(value = “撤销授权(RequestMapping)”)
@RequestMapping(“/oauth/revoke/{source}/{token}”)
public Object revokeAuth(@PathVariable(“source”) String source, @PathVariable(“token”) Str
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。