diff options
author | 2017-07-21 11:35:43 +0300 | |
---|---|---|
committer | 2017-07-21 11:39:54 +0300 | |
commit | df0bb7c64a5c2a637af23bbb19d501a66e8805e4 (patch) | |
tree | 3b40b862ed49f66a1e7d72c9599f29eeeb7def03 /juick-www | |
parent | 664bc928c2ec6b1afb23636ddfc17424973d7dab (diff) |
www: update scribejava deprecated api calls
Diffstat (limited to 'juick-www')
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) |