mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 13:06:54 +08:00
去掉多余容易引起误解的测试使用的接口方法oauth2buildAuthorizationUrl
This commit is contained in:
parent
27ad02dd71
commit
977161cbeb
@ -152,16 +152,6 @@ public interface WxMpService {
|
||||
*/
|
||||
WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 构造oauth2授权的url连接
|
||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
|
||||
* </pre>
|
||||
*
|
||||
* @return url
|
||||
*/
|
||||
String oauth2buildAuthorizationUrl(String scope, String state);
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 构造oauth2授权的url连接
|
||||
|
@ -238,11 +238,6 @@ public class WxMpServiceImpl implements WxMpService {
|
||||
return WxMpSemanticQueryResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String oauth2buildAuthorizationUrl(String scope, String state) {
|
||||
return this.oauth2buildAuthorizationUrl(this.wxMpConfigStorage.getOauth2redirectUri(), scope, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state) {
|
||||
StringBuilder url = new StringBuilder();
|
||||
|
@ -14,14 +14,14 @@ import java.util.Map;
|
||||
*/
|
||||
public class DemoOAuth2Handler implements WxMpMessageHandler {
|
||||
@Override
|
||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context,
|
||||
WxMpService wxMpService, WxSessionManager sessionManager) {
|
||||
String href = "<a href=\"" + wxMpService.oauth2buildAuthorizationUrl(WxConsts.OAUTH2_SCOPE_USER_INFO, null)
|
||||
+ "\">测试oauth2</a>";
|
||||
return WxMpXmlOutMessage
|
||||
.TEXT()
|
||||
.content(href)
|
||||
.fromUser(wxMessage.getToUserName())
|
||||
.toUser(wxMessage.getFromUserName()).build();
|
||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
|
||||
Map<String, Object> context, WxMpService wxMpService,
|
||||
WxSessionManager sessionManager) {
|
||||
String href = "<a href=\"" + wxMpService.oauth2buildAuthorizationUrl(
|
||||
wxMpService.getWxMpConfigStorage().getOauth2redirectUri(),
|
||||
WxConsts.OAUTH2_SCOPE_USER_INFO, null) + "\">测试oauth2</a>";
|
||||
return WxMpXmlOutMessage.TEXT().content(href)
|
||||
.fromUser(wxMessage.getToUserName()).toUser(wxMessage.getFromUserName())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user