public class AuthyUtil extends Object
Copyright © 2017 Twilio, Inc. All Rights Reserved.
| Modifier and Type | Field and Description |
|---|---|
static String |
HEADER_AUTHY_SIGNATURE |
static String |
HEADER_AUTHY_SIGNATURE_NONCE |
| Constructor and Description |
|---|
AuthyUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
extract(String pre,
org.json.JSONObject obj,
HashMap<String,String> map) |
static Properties |
loadProperties(String path,
Class cls)
Loads your api_key and api_url properties from the given property file
|
static String |
mapToQuery(Map<String,String> map) |
static boolean |
validateSignatureForGet(Map<String,String> params,
Map<String,String> headers,
String url,
String apiKey)
Validates the request information to
|
static boolean |
validateSignatureForPost(String body,
Map<String,String> headers,
String url,
String apiKey)
Validates the request information to
|
public static final String HEADER_AUTHY_SIGNATURE_NONCE
public static final String HEADER_AUTHY_SIGNATURE
public static String mapToQuery(Map<String,String> map) throws OneTouchException, UnsupportedEncodingException
public static boolean validateSignatureForPost(String body, Map<String,String> headers, String url, String apiKey) throws OneTouchException, UnsupportedEncodingException
body - The body of the request in case of a POST methodheaders - The headers of the requesturl - The url of the request.apiKey - the security token from the authy libraryOneTouchExceptionUnsupportedEncodingException - if the string parameters have problems with UTF-8 encoding.public static boolean validateSignatureForGet(Map<String,String> params, Map<String,String> headers, String url, String apiKey) throws OneTouchException, UnsupportedEncodingException
params - The query parameters in case of a GET requestheaders - The headers of the requesturl - The url of the request.apiKey - the security token from the authy libraryOneTouchExceptionUnsupportedEncodingException - if the string parameters have problems with UTF-8 encoding.public static Properties loadProperties(String path, Class cls)
Two important things to have in mind here: 1) if api_key and api_url are defined as environment variables, they will be returned as the properties. 2) If you want to load your properties file have in mind your classloader path may change.
Copyright © 2019. All rights reserved.