params[14] = new HttpParameter("pass", p.getProperty("login.password"));
params[15] = new HttpParameter("persistent", "1");
params[16] = new HttpParameter("default_persistent", "0");
params[17] = new HttpParameter("login", "ログイン");
response = http.request(new HttpRequest(RequestMethod.POST, authorizeURL, params, null, null));
// dialog
String dialogURL = response.getResponseHeader("Location").replaceAll("&%3B", "&");
response = http.request(new HttpRequest(RequestMethod.GET, dialogURL, null, null, null));
if (null != response.getResponseHeader("Location")) {
String redirectURL = response.getResponseHeader("Location");
assertThat(redirectURL.contains("code"), is(true));
return;
}
// read
resStr = response.asString();
String readURL = "https://www.facebook.com" + catchPattern(resStr, "id=\\\"platformDialogForm\\\" action=\\\"", "\" method=\\\"post\\\"").replaceAll("\\\\", "");
params = new HttpParameter[18];
params[0] = new HttpParameter("fb_dtsg", catchPattern(resStr
, "name=\\\"fb_dtsg\\\" value=\\\"", "\\\" autocomplete=\\\"off\\\" \\/>"));
params[1] = new HttpParameter("app_id", oAuthAppId);
params[2] = new HttpParameter("redirect_uri", callbackURL);
params[3] = new HttpParameter("display", "page");
params[4] = new HttpParameter("access_token", "");
params[5] = new HttpParameter("sdk", "");
params[6] = new HttpParameter("from_post", "1");
params[7] = new HttpParameter("public_info_nux", catchPattern(resStr
, "name=\\\"public_info_nux\\\" value=\\\"", "\\\" \\/>"));
params[8] = new HttpParameter("login", catchPattern(resStr
, "name=\\\"login\\\" value=\\\"", "\\\" \\/>"));
params[9] = new HttpParameter("read", catchPattern(resStr
, "name=\\\"read\\\" value=\\\"", "\\\" \\/>"));
params[10] = new HttpParameter("write", catchPattern(resStr
, "name=\\\"write\\\" value=\\\"", "\\\" \\/>"));
params[11] = new HttpParameter("extended", catchPattern(resStr
, "name=\\\"extended\\\" value=\\\"", "\\\" \\/>"));
params[12] = new HttpParameter("confirm", catchPattern(resStr
, "name=\\\"confirm\\\" value=\\\"", "\\\" \\/>"));
params[13] = new HttpParameter("auth_type", "");
params[14] = new HttpParameter("auth_nonce", "");
params[15] = new HttpParameter("return_format", catchPattern(resStr
, "name=\\\"return_format\\\" value=\\\"", "\\\" \\/>"));
params[16] = new HttpParameter("domain", "");
params[17] = new HttpParameter("sso_device", "");
response = http.request(new HttpRequest(RequestMethod.POST, readURL, params, null, null));
String redirectURL = response.getResponseHeader("Location");
assertThat(redirectURL.contains("code"), is(true));
}