diff options
Diffstat (limited to 'juick-www/src')
3 files changed, 12 insertions, 9 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java index 2b85c07c..0233899f 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java +++ b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java @@ -38,6 +38,7 @@ import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; +import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; @@ -69,8 +70,9 @@ public class FacebookLogin { @Inject UserService userService; - public FacebookLogin() { - serviceBuilder = new ServiceBuilder(); + @PostConstruct + public void init() { + serviceBuilder = new ServiceBuilder(FACEBOOK_APPID); } @GetMapping("/_fblogin") @@ -85,7 +87,6 @@ public class FacebookLogin { Cookie c = new Cookie("fbstate", fbstate); response.addCookie(c); OAuth20Service facebookAuthService = serviceBuilder - .apiKey(FACEBOOK_APPID) .apiSecret(FACEBOOK_SECRET) .callback(FACEBOOK_REDIRECT) .scope("publish_actions") diff --git a/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java b/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java index dd559fc3..fb63069c 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java +++ b/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java @@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; @@ -59,8 +60,9 @@ public class TwitterAuth { private ServiceBuilder serviceBuilder; - public TwitterAuth() { - serviceBuilder = new ServiceBuilder(); + @PostConstruct + public void init() { + serviceBuilder = new ServiceBuilder(consumerKey); } @GetMapping("/_twitter") @@ -86,7 +88,6 @@ public class TwitterAuth { return; } OAuth10aService oAuthService = serviceBuilder - .apiKey(consumerKey) .apiSecret(consumerSecret) .callback("http://juick.com/_twitter") .build(TwitterApi.instance()); diff --git a/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java b/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java index c9306ac6..07bd7455 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java +++ b/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java @@ -38,6 +38,7 @@ import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; +import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; @@ -65,8 +66,9 @@ public class VKontakteLogin { private ServiceBuilder serviceBuilder; - public VKontakteLogin() { - serviceBuilder = new ServiceBuilder(); + @PostConstruct + public void init() { + serviceBuilder = new ServiceBuilder(VK_APPID); } @Inject @@ -83,7 +85,6 @@ public class VKontakteLogin { Cookie c = new Cookie("vkstate", vkstate); response.addCookie(c); OAuth20Service vkAuthService = serviceBuilder - .apiKey(VK_APPID) .apiSecret(VK_SECRET) .scope("friends,wall,offline") .state(vkstate) |