aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/api/ApiSocialLogin.java9
-rw-r--r--src/main/java/com/juick/www/api/Service.java2
-rw-r--r--src/main/java/com/juick/www/controllers/SocialLogin.java9
3 files changed, 8 insertions, 12 deletions
diff --git a/src/main/java/com/juick/www/api/ApiSocialLogin.java b/src/main/java/com/juick/www/api/ApiSocialLogin.java
index 101f6b1f..8b331781 100644
--- a/src/main/java/com/juick/www/api/ApiSocialLogin.java
+++ b/src/main/java/com/juick/www/api/ApiSocialLogin.java
@@ -34,13 +34,11 @@ import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.juick.model.AuthResponse;
import com.juick.model.ext.facebook.User;
-import com.juick.util.HttpBadRequestException;
+import com.juick.model.ext.vk.UsersResponse;
import com.juick.service.CrosspostService;
import com.juick.service.EmailService;
import com.juick.service.UserService;
-import com.juick.model.ext.vk.UsersResponse;
-import com.nimbusds.jose.JOSEException;
-import com.nimbusds.jose.proc.BadJOSEException;
+import com.juick.util.HttpBadRequestException;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@@ -60,7 +58,6 @@ import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.IOException;
import java.security.GeneralSecurityException;
-import java.text.ParseException;
import java.util.Collections;
import java.util.Map;
import java.util.UUID;
@@ -291,7 +288,7 @@ public class ApiSocialLogin {
throw new HttpBadRequestException();
}
@PostMapping("/api/_applelogin")
- public String doVerifyAppleResponse(@RequestParam Map<String, String> body) throws InterruptedException, ExecutionException, IOException, ParseException, JOSEException, BadJOSEException {
+ public String doVerifyAppleResponse(@RequestParam Map<String, String> body) throws InterruptedException, ExecutionException, IOException {
OAuth2AccessToken token = appleSignInService.getAccessToken(body.get("code"));
var jsonNode = jsonMapper.readTree(token.getRawResponse());
var idToken = jsonNode.get("id_token").textValue();
diff --git a/src/main/java/com/juick/www/api/Service.java b/src/main/java/com/juick/www/api/Service.java
index 850acb9d..dc001428 100644
--- a/src/main/java/com/juick/www/api/Service.java
+++ b/src/main/java/com/juick/www/api/Service.java
@@ -203,7 +203,7 @@ public class Service {
.forEach(session -> serverManager.getSessions().remove(session));
}
@GetMapping("/api/events")
- public SseEmitter handle(@Visitor User visitor) throws IOException {
+ public SseEmitter handle(@Visitor User visitor) {
logger.info("{} connected", visitor.getName());
if (!visitor.isAnonymous()) {
userService.updateLastSeen(visitor);
diff --git a/src/main/java/com/juick/www/controllers/SocialLogin.java b/src/main/java/com/juick/www/controllers/SocialLogin.java
index ffd785b7..1f99efc1 100644
--- a/src/main/java/com/juick/www/controllers/SocialLogin.java
+++ b/src/main/java/com/juick/www/controllers/SocialLogin.java
@@ -24,15 +24,13 @@ import com.github.scribejava.core.oauth.OAuth10aService;
import com.github.scribejava.core.oauth.OAuth20Service;
import com.juick.model.ext.facebook.User;
import com.juick.model.ext.vk.UsersResponse;
-import com.juick.util.HttpBadRequestException;
import com.juick.service.CrosspostService;
import com.juick.service.EmailService;
import com.juick.service.TelegramService;
import com.juick.service.UserService;
import com.juick.service.security.annotation.Visitor;
+import com.juick.util.HttpBadRequestException;
import com.juick.util.WebUtils;
-import com.nimbusds.jose.JOSEException;
-import com.nimbusds.jose.proc.BadJOSEException;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;
@@ -55,7 +53,6 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.text.ParseException;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -341,7 +338,9 @@ public class SocialLogin {
throw new HttpBadRequestException();
}
@PostMapping("/_apple")
- public String doVerifyAppleResponse(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> body) throws InterruptedException, ExecutionException, IOException, ParseException, JOSEException, BadJOSEException {
+ public String doVerifyAppleResponse(HttpServletRequest request, HttpServletResponse response,
+ @RequestParam Map<String, String> body)
+ throws InterruptedException, ExecutionException, IOException {
OAuth2AccessToken token = appleSignInService.getAccessToken(body.get("code"));
var jsonNode = jsonMapper.readTree(token.getRawResponse());
var idToken = jsonNode.get("id_token").textValue();