/** * Generates an OAuth signature for the given request, parameters and * secrets, and stores it as a signature parameter, and writes the * OAuth parameters to the request as an Authorization header. * * @param request the request to generate signature for and write header to. * @param params the OAuth authorization parameters. * @param secrets the secrets used to generate the OAuth signature. * @throws OAuthSignatureException if an error occurred generating the signature. */ public static void sign(OAuthRequest request, OAuthParameters params, OAuthSecrets secrets) throws OAuthSignatureException { params = (OAuthParameters)params.clone(); // don't modify caller's parameters params.setSignature(generate(request, params, secrets)); params.writeRequest(request); }
/** * Generates an OAuth signature for the given request, parameters and * secrets, and stores it as a signature parameter, and writes the * OAuth parameters to the request as an Authorization header. * * @param request the request to generate signature for and write header to. * @param params the OAuth authorization parameters. * @param secrets the secrets used to generate the OAuth signature. * @throws OAuthSignatureException if an error occurred generating the signature. */ public static void sign(OAuthRequest request, OAuthParameters params, OAuthSecrets secrets) throws OAuthSignatureException { params = (OAuthParameters)params.clone(); // don't modify caller's parameters params.setSignature(generate(request, params, secrets)); params.writeRequest(request); }
final OAuthParameters p = (OAuthParameters)parameters.clone(); // make modifications to clone