SHARE
TWEET

Untitled

a guest Apr 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  private void getToken(String url) {
  2.         String accessToken = "";
  3.         StringBuilder strBuild = new StringBuilder();
  4.  
  5.         String authURL = "https://login.ipleiria.pt/adfs/ls/?client-request-id=5d88995c-4405-40c7-985f-a02fd6d62749&username=&wa=wsignin1.0&wtrealm=urn%3afederation%3aMicrosoftOnline&wctx=estsredirect%3d2%26estsrequest%3drQIIAY2RO2_TUABGc-PEbaMKKsTAgEQHpEpI176-14_YEhLOw2mihDRJCWCBKtuxEzdObPzIa2Pr2IEBOiHElJEBIf4AUsXQqUN_QcWEmBgYaMTCBmc4-ubz3aM4hlPuoj9guDJEjsNBy16tvwhv5LaevTl6ni19efD64C17fr5TPQHXRnPGDTzbDV2DCeIluDOI4yBSWNZPYs_3h4zvOK5lM5Y_Yv2pwX4C4AyAZVoSiZiX8rKABUw4TLBAGCKKHI-wDEWMLMjjngMNCROICTIkx-Z4yxQv0tebahIP8Ep-6C7sH-kNxw9HB4EfxSfUK1Cy4kIpqvbL5UIb1RO-3PcXjXqnPjuM-b6gNatoaFZQ7XBSRxGJZTnUO2Iv6DWTmdgtVrwGP2sN1HGguhW3PVet3eFcm-JW-2k3atSQqor7Lyb8UINDSCJnz8vbu16Xx9CR9Xwy6xgjTeppiVM3ySNB79RMW-C6e3BJ_VfjDxR91Wnkj08p2g_ssds7y4BvmU1EKevrua3UrdR26mcGvMteffH-csreXtspvZzYvz5ufk2dZlm2bZS1_mLgdcbF_ccto2BOpPzDqDEvPklCvWvpbWLwXpUvmf37ROGOaXBM05c0-E6Do7XU541_fXeRu4kRJ0NEIMdtc0hBSBGw_hs1&RedirectToIdentityProvider=http%3a%2f%2flogin.ipleiria.pt%2fadfs%2fservices%2ftrust";
  6.         String client_secret = "*******************";
  7.         String redirect_uri = "urn:ietf:wg:oauth:2.0:oob";
  8.         strBuild
  9.                 .append("&client_secret=").append(client_secret)
  10.                 .append("&redirect_uri=").append(redirect_uri);
  11.  
  12.  
  13.         try{
  14.             java.net.URL obj = new URL(authURL);
  15.  
  16.             HttpURLConnection con = (HttpURLConnection) obj.openConnection();
  17.             con.setDoOutput(true);
  18.             con.setRequestMethod("POST");
  19.  
  20.             con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  21.  
  22.             DataOutputStream wr = new DataOutputStream(con.getOutputStream());
  23.             wr.writeBytes(strBuild.toString());
  24.             wr.flush();
  25.             wr.close();
  26.  
  27.             //OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
  28.             System.out.println(con.getResponseCode());
  29.             System.out.println(con.getResponseMessage());
  30.  
  31.         }catch (Exception e)
  32.         {
  33.             System.out.println("Error.");
  34.         }
  35.         System.out.println(strBuild.toString());
  36.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top