### Question:
OAuthResponseParams { static String filterSecrets(String in) { Matcher m = REMOVE_SECRETS.matcher(in); return m.replaceAll("REMOVED"); } OAuthResponseParams(SecurityToken securityToken, HttpRequest originalRequest,
      BlobCrypter stateCrypter); void logDetailedWarning(String note); void logDetailedWarning(String note, Throwable e); void logDetailedInfo(String note, Throwable e); void addRequestTrace(HttpRequest request, HttpResponse response); boolean sawErrorResponse(); void addToResponse(HttpResponseBuilder response, OAuthRequestException e); OAuthClientState getNewClientState(); String getAznUrl(); void setAznUrl(String aznUrl); boolean sendTraceToClient(); void setSendTraceToClient(boolean sendTraceToClient); static final String CLIENT_STATE; static final String APPROVAL_URL; static final String ERROR_CODE; static final String ERROR_TEXT; }### Answer:
@Test public void testStripSecretsFromRequestHeader() { HttpRequest req = new HttpRequest(Uri.parse("http: req.setHeader("Authorization", "OAuth opensocial_owner_id=\"owner\", opensocial_viewer_id=" + "\"owner\", opensocial_app_id=\"app\", opensocial_app_url=\"http%3A%2F%2Fwww.examp" + "le.com%2Fheader.xml\", oauth_version=\"1.0\", oauth_timestamp=\"1231461306\", oau" + "th_consumer_key=\"consumer\", oauth_signature_method=\"HMAC-SHA1\", oauth_nonce" + "=\"1231461308333563000\", oauth_session_handle=\"w0zAI1yN5ZRvmBX5kcVdra5%2BbZE%" + "3D\""); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }
@Test public void testStripSecretsFromRequestUrl() { HttpRequest req = new HttpRequest(Uri.parse("http: "cial_owner_id=owner&opensocial_viewer_id=owner&opensocial_app_id=app&" + "oauth_session_handle" + "=http%3A%2F%2Fwww.example.com%2Fgadget.xml&oauth_version=1.0&oauth_timestamp=12" + "31461132&oauth_consumer_key=consumer&oauth_signature_method=HMAC-SHA1&oauth_nonce=1" + "231461160262578000&oauth_signature=HuFQ%2BRYTrRzcgsi3al6ld9Msvoo%3D")); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }