/** * Returns as hash map of loaded OAuth methods. */ private static HashMap<String, OAuthSignatureMethod> loadMethods() { HashMap<String, OAuthSignatureMethod> map = new HashMap<String, OAuthSignatureMethod>(); for (OAuthSignatureMethod method : ServiceFinder.find(OAuthSignatureMethod.class, true)) { map.put(method.name(), method); } return map; } }
/** * Verifies the OAuth signature for a given request, parameters and * secrets. * * @param request the request to verify the signature from. * @param params the OAuth authorization parameters * @param secrets the secrets used to verify the OAuth signature. * @return true if the signature is verified. * @throws OAuthSignatureException if an error occurred generating the signature. */ public static boolean verify(OAuthRequest request, OAuthParameters params, OAuthSecrets secrets) throws OAuthSignatureException { return getSignatureMethod(params).verify(elements(request, params), secrets, params.getSignature()); }
/** * Generates and returns an OAuth signature for the given request, * parameters and secrets. * * @param request the request to generate signature for. * @param params the OAuth authorization parameters. * @param secrets the secrets used to generate the OAuth signature. * @return the OAuth digital signature. * @throws OAuthSignatureException if an error occurred generating the signature. */ public static String generate(OAuthRequest request, OAuthParameters params, OAuthSecrets secrets) throws OAuthSignatureException { return getSignatureMethod(params).sign(elements(request, params), secrets); }
/** * Verifies the OAuth signature for a given request, parameters and * secrets. * * @param request the request to verify the signature from. * @param params the OAuth authorization parameters * @param secrets the secrets used to verify the OAuth signature. * @return true if the signature is verified. * @throws OAuthSignatureException if an error occurred generating the signature. */ public static boolean verify(OAuthRequest request, OAuthParameters params, OAuthSecrets secrets) throws OAuthSignatureException { return getSignatureMethod(params).verify(elements(request, params), secrets, params.getSignature()); }
/** * Generates and returns an OAuth signature for the given request, * parameters and secrets. * * @param request the request to generate signature for. * @param params the OAuth authorization parameters. * @param secrets the secrets used to generate the OAuth signature. * @return the OAuth digital signature. * @throws SignatureException if an error occurred generating the signature. */ public static String generate(OAuthRequest request, OAuthParameters params, OAuthSecrets secrets) throws OAuthSignatureException { return getSignatureMethod(params).sign(elements(request, params), secrets); }
/** * Returns as hash map of loaded OAuth methods. */ private static HashMap<String, OAuthSignatureMethod> loadMethods() { HashMap<String, OAuthSignatureMethod> map = new HashMap<String, OAuthSignatureMethod>(); for (OAuthSignatureMethod method : ServiceFinder.find(OAuthSignatureMethod.class, true)) { map.put(method.name(), method); } return map; } }