From 9046b1c8f822255332913514e2e7a1e362c7ba3c Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Thu, 20 Sep 2018 16:23:19 +0300
Subject: drop duplicated social api mappings
---
.../juick/server/www/controllers/SocialLogin.java | 10 +-
.../java/com/juick/server/www/facebook/User.java | 125 ---------------------
.../java/com/juick/server/www/twitter/User.java | 38 -------
.../main/java/com/juick/server/www/vk/Token.java | 56 ---------
.../main/java/com/juick/server/www/vk/User.java | 65 -----------
.../com/juick/server/www/vk/UsersResponse.java | 38 -------
6 files changed, 5 insertions(+), 327 deletions(-)
delete mode 100644 juick-server/src/main/java/com/juick/server/www/facebook/User.java
delete mode 100644 juick-server/src/main/java/com/juick/server/www/twitter/User.java
delete mode 100644 juick-server/src/main/java/com/juick/server/www/vk/Token.java
delete mode 100644 juick-server/src/main/java/com/juick/server/www/vk/User.java
delete mode 100644 juick-server/src/main/java/com/juick/server/www/vk/UsersResponse.java
(limited to 'juick-server/src/main/java/com/juick')
diff --git a/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java b/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java
index 367efdfa..93d3946a 100644
--- a/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java
+++ b/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java
@@ -24,6 +24,7 @@ import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.*;
import com.github.scribejava.core.oauth.OAuth10aService;
import com.github.scribejava.core.oauth.OAuth20Service;
+import com.juick.facebook.User;
import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.UserUtils;
import com.juick.service.CrosspostService;
@@ -31,8 +32,7 @@ import com.juick.service.EmailService;
import com.juick.service.TelegramService;
import com.juick.service.UserService;
import com.juick.server.www.Utils;
-import com.juick.server.www.facebook.User;
-import com.juick.server.www.vk.UsersResponse;
+import com.juick.vk.UsersResponse;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;
@@ -216,8 +216,8 @@ public class SocialLogin {
OAuth1AccessToken accessToken = oAuthService.getAccessToken(requestToken, verifier);
OAuthRequest oAuthRequest = new OAuthRequest(Verb.GET, TWITTER_VERIFY_URL);
oAuthService.signRequest(accessToken, oAuthRequest);
- com.juick.server.www.twitter.User twitterUser = jsonMapper.readValue(oAuthService.execute(oAuthRequest).getBody(),
- com.juick.server.www.twitter.User.class);
+ com.juick.twitter.User twitterUser = jsonMapper.readValue(oAuthService.execute(oAuthRequest).getBody(),
+ com.juick.twitter.User.class);
if (userService.linkTwitterAccount(user, accessToken.getToken(), accessToken.getTokenSecret(),
twitterUser.getScreenName())) {
response.setStatus(HttpServletResponse.SC_FOUND);
@@ -265,7 +265,7 @@ public class SocialLogin {
vkService.signRequest(token, meRequest);
String graph = vkService.execute(meRequest).getBody();
- com.juick.server.www.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
+ com.juick.vk.User jsonUser = jsonMapper.readValue(graph, UsersResponse.class).getUsers().get(0);
String vkName = jsonUser.getFirstName() + " " + jsonUser.getLastName();
String vkLink = jsonUser.getScreenName();
diff --git a/juick-server/src/main/java/com/juick/server/www/facebook/User.java b/juick-server/src/main/java/com/juick/server/www/facebook/User.java
deleted file mode 100644
index b85cf65c..00000000
--- a/juick-server/src/main/java/com/juick/server/www/facebook/User.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.server.www.facebook;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class User {
- private String id;
- private String name;
- private String link;
- private boolean verified;
- private String firstName;
- private String lastName;
- private String gender;
- private String locale;
- private String timezone;
- private String updatedTime;
- private String email;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getLink() {
- return link;
- }
-
- public void setLink(String link) {
- this.link = link;
- }
-
- public boolean getVerified() {
- return verified;
- }
-
- public void setVerified(boolean verified) {
- this.verified = verified;
- }
-
- @JsonProperty("first_name")
- public String getFirstName() {
- return firstName;
- }
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- @JsonProperty("last_name")
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getLocale() {
- return locale;
- }
-
- public void setLocale(String locale) {
- this.locale = locale;
- }
-
- public String getTimezone() {
- return timezone;
- }
-
- public void setTimezone(String timezone) {
- this.timezone = timezone;
- }
-
- @JsonProperty("updated_time")
- public String getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(String updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getEmail() {
- return email;
- }
-}
diff --git a/juick-server/src/main/java/com/juick/server/www/twitter/User.java b/juick-server/src/main/java/com/juick/server/www/twitter/User.java
deleted file mode 100644
index 35f708f7..00000000
--- a/juick-server/src/main/java/com/juick/server/www/twitter/User.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.server.www.twitter;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class User {
- private String screenName;
-
- @JsonProperty("screen_name")
- public String getScreenName() {
- return screenName;
- }
-
- public void setScreenName(String screenName) {
- this.screenName = screenName;
- }
-}
diff --git a/juick-server/src/main/java/com/juick/server/www/vk/Token.java b/juick-server/src/main/java/com/juick/server/www/vk/Token.java
deleted file mode 100644
index c6277245..00000000
--- a/juick-server/src/main/java/com/juick/server/www/vk/Token.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.server.www.vk;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-public class Token {
- private Long userId;
- private String accessToken;
- private String expiresIn;
-
- @JsonProperty("user_id")
- public Long getUserId() {
- return userId;
- }
-
- public void setUserId(Long userId) {
- this.userId = userId;
- }
-
- @JsonProperty("access_token")
- public String getAccessToken() {
- return accessToken;
- }
-
- public void setAccessToken(String accessToken) {
- this.accessToken = accessToken;
- }
-
- @JsonProperty("expires_in")
- public String getExpiresIn() {
- return expiresIn;
- }
-
- public void setExpiresIn(String expiresIn) {
- this.expiresIn = expiresIn;
- }
-}
diff --git a/juick-server/src/main/java/com/juick/server/www/vk/User.java b/juick-server/src/main/java/com/juick/server/www/vk/User.java
deleted file mode 100644
index 0c491166..00000000
--- a/juick-server/src/main/java/com/juick/server/www/vk/User.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.server.www.vk;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-public class User {
- private String id;
- private String firstName;
- private String lastName;
- private String screenName;
-
- @JsonProperty("first_name")
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- @JsonProperty("last_name")
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- @JsonProperty("screen_name")
- public String getScreenName() {
- return screenName;
- }
-
- public void setScreenName(String screenName) {
- this.screenName = screenName;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-}
diff --git a/juick-server/src/main/java/com/juick/server/www/vk/UsersResponse.java b/juick-server/src/main/java/com/juick/server/www/vk/UsersResponse.java
deleted file mode 100644
index d16b9921..00000000
--- a/juick-server/src/main/java/com/juick/server/www/vk/UsersResponse.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package com.juick.server.www.vk;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.List;
-
-/**
- * Created by vitalyster on 28.11.2016.
- */
-public class UsersResponse {
- private List users;
-
- @JsonProperty("response")
- public List getUsers() {
- return users;
- }
-
- public void setUsers(List users) {
- this.users = users;
- }
-}
--
cgit v1.2.3