@Test public void testApplyOAuthParameters() throws Exception { Map<String, Object> params = new HashMap<String, Object>(); params.put("error", "invalid_token"); params.put("error_uri", "http: params.put("scope", "s1 s2 s3"); params.put("empty_param", ""); params.put("null_param", null); params.put("", "some_value"); params.put(null, "some_value"); OAuthResponse res = OAuthResponse.status(200).location("").buildQueryMessage(); OAuthParametersApplier applier = new WWWAuthHeaderParametersApplier(); res = (OAuthResponse)applier.applyOAuthParameters(res, params); assertNotNull(res); String header = res.getHeader(OAuth.HeaderType.WWW_AUTHENTICATE); assertNotNull(header); assertEquals(OAuth.OAUTH_HEADER_NAME + " scope=\"s1 s2 s3\",error=\"invalid_token\",error_uri=\"http: header); }
public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String header = OAuthUtils.encodeOAuthHeader(params); message.addHeader(OAuth.HeaderType.WWW_AUTHENTICATE, header); return message; }
WWWAuthHeaderParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String header = OAuthUtils.encodeOAuthHeader(params); message.addHeader(OAuth.HeaderType.WWW_AUTHENTICATE, header); return message; } }
WWWAuthHeaderParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String header = OAuthUtils.encodeOAuthHeader(params); message.addHeader(OAuth.HeaderType.WWW_AUTHENTICATE, header); return message; }  }
WWWAuthHeaderParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String header = OAuthUtils.encodeOAuthHeader(params); message.addHeader(OAuth.HeaderType.WWW_AUTHENTICATE, header); return message; }  OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params); }
WWWAuthHeaderParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String header = OAuthUtils.encodeOAuthHeader(params); message.addHeader(OAuth.HeaderType.WWW_AUTHENTICATE, header); return message; }  OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params);  }