/** * Assembles request elements for which a digital signature is to be * generated/verified, per section 9.1.3 of the OAuth 1.0 specification. * * @param request the request from which to assemble elements. * @param params the OAuth authorization parameters from which to assemble elements. * @return the concetenated elements, ready to sign/verify */ private static String elements(OAuthRequest request, OAuthParameters params) throws OAuthSignatureException { StringBuffer buf = new StringBuffer(URLCodec.encode(request.getRequestMethod().toUpperCase())); buf.append('&').append(URLCodec.encode(constructRequestURL(request))); buf.append('&').append(URLCodec.encode(normalizeParameters(request, params))); return buf.toString(); }
/** * Assembles request elements for which a digital signature is to be * generated/verified, per section 9.1.3 of the OAuth 1.0 specification. * * @param request the request from which to assemble elements. * @param params the OAuth authorization parameters from which to assemble elements. * @return the concatenated elements, ready to sign/verify */ private static String elements(OAuthRequest request, OAuthParameters params) throws OAuthSignatureException { // HTTP request method StringBuilder buf = new StringBuilder(request.getRequestMethod().toUpperCase()); // request URL, see section 3.4.1.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.2 buf.append('&').append(UriComponent.encode(constructRequestURL(request).toASCIIString(), UriComponent.Type.UNRESERVED)); // normalized request parameters, see section 3.4.1.3.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.3.2 buf.append('&').append(UriComponent.encode(normalizeParameters(request, params), UriComponent.Type.UNRESERVED)); return buf.toString(); }