From 206139a3cbb885197fdf4b3b17b92521eae5ce33 Mon Sep 17 00:00:00 2001 From: "Yuan, Harry Hongbin" Date: Sun, 5 May 2024 19:05:24 +0200 Subject: [PATCH] change manner (#245) --- .../oauth2/controller/DiscordOAuthController.java | 4 ++-- .../oauth2/controller/TelegramOAuthController.java | 2 +- .../dl/officialsite/oauth2/controller/TwitterController.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/dl/officialsite/oauth2/controller/DiscordOAuthController.java b/src/main/java/com/dl/officialsite/oauth2/controller/DiscordOAuthController.java index f82d5aeb..34828236 100644 --- a/src/main/java/com/dl/officialsite/oauth2/controller/DiscordOAuthController.java +++ b/src/main/java/com/dl/officialsite/oauth2/controller/DiscordOAuthController.java @@ -62,8 +62,8 @@ public void twitterOauthLogin(@RequestParam(name = "test", defaultValue = "false .toUriString()); } - @PostMapping("/oauth2/callback/discord") - public BaseResponse getTwitter(@RequestParam("code") String code, @RequestParam(required = false) String addressForTesting, + @PostMapping("oauth2/callback/discord") + public BaseResponse discordCallback(@RequestParam("code") String code, @RequestParam(required = false) String addressForTesting, HttpSession session) { // 检查用户是否注册 SessionUserInfo sessionUserInfo = HttpSessionUtils.getMember(session); diff --git a/src/main/java/com/dl/officialsite/oauth2/controller/TelegramOAuthController.java b/src/main/java/com/dl/officialsite/oauth2/controller/TelegramOAuthController.java index 4cdf31a1..e46d02b0 100644 --- a/src/main/java/com/dl/officialsite/oauth2/controller/TelegramOAuthController.java +++ b/src/main/java/com/dl/officialsite/oauth2/controller/TelegramOAuthController.java @@ -30,7 +30,7 @@ public class TelegramOAuthController { private TwitterConnectionFactory connectionFactory = null; - @PostMapping("/oauth2/callback/telegram") + @PostMapping("oauth2/callback/telegram") public BaseResponse verifyTelegram(@RequestParam Map params, @RequestParam(required = false) String addressForTesting, HttpSession session) { SessionUserInfo sessionUserInfo = HttpSessionUtils.getMember(session); diff --git a/src/main/java/com/dl/officialsite/oauth2/controller/TwitterController.java b/src/main/java/com/dl/officialsite/oauth2/controller/TwitterController.java index a775052e..21aa8621 100644 --- a/src/main/java/com/dl/officialsite/oauth2/controller/TwitterController.java +++ b/src/main/java/com/dl/officialsite/oauth2/controller/TwitterController.java @@ -34,7 +34,7 @@ public class TwitterController { @Autowired private TwitterOAuthConfig twitterOAuthConfig; - @GetMapping("/oauth2/authorize/normal/twitter") + @GetMapping("oauth2/authorize/normal/twitter") public void twitterOauthLogin(@RequestParam(name = "test", defaultValue = "false") boolean test, HttpServletResponse response) throws IOException { String authorizeUrl = this.generateAuthorizeUrl(test); @@ -56,7 +56,7 @@ private String generateAuthorizeUrl(boolean test) { return oauthOperations.buildAuthorizeUrl(requestToken.getValue(), oAuth1Parameters); } - @GetMapping("/oauth2/callback/twitter") + @GetMapping("oauth2/callback/twitter") public BaseResponse getTwitter(@RequestParam("oauth_token") String oauthToken, @RequestParam("oauth_verifier") String oauthVerifier, @RequestParam(value = "secret", required = false) String secret, HttpServletRequest request) { Pair twitterUserNameAndScreenName = fetchProfile(oauthToken, oauthVerifier, secret);