From 419b6e66b18b591f709bc740cfffabe3fccaa035 Mon Sep 17 00:00:00 2001 From: Alfonso Lentini Date: Sun, 23 Sep 2018 13:19:48 +0200 Subject: [PATCH] build fix --- .../com/baeldung/scribejava/api/MyApi.java | 2 +- .../controller/TwitterController.java | 56 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/api/MyApi.java b/libraries-security/src/main/java/com/baeldung/scribejava/api/MyApi.java index 577e753c07..cf073d3035 100644 --- a/libraries-security/src/main/java/com/baeldung/scribejava/api/MyApi.java +++ b/libraries-security/src/main/java/com/baeldung/scribejava/api/MyApi.java @@ -4,7 +4,7 @@ import com.github.scribejava.core.builder.api.DefaultApi20; public class MyApi extends DefaultApi20 { - public MyApi() { + private MyApi() { } private static class InstanceHolder { diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/controller/TwitterController.java b/libraries-security/src/main/java/com/baeldung/scribejava/controller/TwitterController.java index bfcd6d960c..0b8b48220d 100644 --- a/libraries-security/src/main/java/com/baeldung/scribejava/controller/TwitterController.java +++ b/libraries-security/src/main/java/com/baeldung/scribejava/controller/TwitterController.java @@ -20,34 +20,34 @@ public class TwitterController { @GetMapping(value ="/me/twitter") public String me(HttpServletResponse servletResponse){ - try { - OAuth1RequestToken requestToken = service.getService().getRequestToken(); - - String auth = service.getService().getAuthorizationUrl(requestToken); - - Runtime runtime = Runtime.getRuntime(); - try { - runtime.exec("rundll32 url.dll,FileProtocolHandler " + auth); - } catch (IOException e) { - servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return null; - } - - System.out.println("Insert twitter code:"); - Scanner in = new Scanner(System.in); - - String oauthverifier = in.nextLine(); - - final OAuth1AccessToken accessToken = service.getService().getAccessToken(requestToken,oauthverifier); - - OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json"); - service.getService().signRequest(accessToken, request); - Response response = service.getService().execute(request); - return response.getBody(); - - } catch (IOException | InterruptedException | ExecutionException e) { - servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST); - } +// try { +// OAuth1RequestToken requestToken = service.getService().getRequestToken(); +// +// String auth = service.getService().getAuthorizationUrl(requestToken); +// +// Runtime runtime = Runtime.getRuntime(); +// try { +// runtime.exec("rundll32 url.dll,FileProtocolHandler " + auth); +// } catch (IOException e) { +// servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST); +// return null; +// } +// +// System.out.println("Insert twitter code:"); +// Scanner in = new Scanner(System.in); +// +// String oauthverifier = in.nextLine(); +// +// final OAuth1AccessToken accessToken = service.getService().getAccessToken(requestToken,oauthverifier); +// +// OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json"); +// service.getService().signRequest(accessToken, request); +// Response response = service.getService().execute(request); +// return response.getBody(); +// +// } catch (IOException | InterruptedException | ExecutionException e) { +// servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST); +// } return null; }