public final class MsalUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CHROME_PACKAGE |
static int |
DEFAULT_EXPIRATION_TIME_SEC
Default access token expiration time in seconds.
|
static java.lang.String |
ENCODING_UTF8
The encoding scheme the sdk uses.
|
static java.lang.String |
QUERY_STRING_DELIMITER |
static java.lang.String |
QUERY_STRING_SYMBOL |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
appendQueryParameterToUrl(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> requestParams)
Append parameter to the url.
|
static java.lang.String |
base64UrlEncodeToString(java.lang.String message) |
static java.util.Date |
calculateExpiresOn(java.lang.String expiresIn)
Calculate expires on based on given exipres in.
|
static java.util.Set<java.lang.String> |
convertArrayToSet(java.lang.String[] values) |
static java.lang.String |
createHash(java.lang.String msg) |
static java.util.Map<java.lang.String,java.lang.String> |
decodeUrlToMap(java.lang.String url,
java.lang.String delimiter)
Decode the given url, and convert it into map with the given delimiter.
|
static java.util.Map<java.lang.String,java.lang.String> |
extractJsonObjectIntoMap(java.lang.String jsonString)
Return the unmodifiable Map of response items.
|
static android.content.pm.ApplicationInfo |
getApplicationInfo(android.content.Context context) |
static java.lang.String |
getChromePackage(android.content.Context context)
CHROME_PACKAGE array contains all the chrome packages that is currently available on play store, we will only support
chrome stable.
|
static java.lang.String |
getChromePackageWithCustomTabSupport(android.content.Context context)
Check if the chrome package with custom tab support is available on the device, and return the package name if
available.
|
static long |
getExpiresOn(long expiresIn) |
static int |
getExpiryOrDefault(java.lang.String expiresIn) |
static java.util.Set<java.lang.String> |
getScopesAsSet(java.lang.String scopes)
Converts the given string of scopes into set.
|
static java.lang.String |
getUniqueUserIdentifier(java.lang.String uid,
java.lang.String utid) |
static java.net.URL |
getUrl(java.lang.String endpoint)
create url from given endpoint.
|
static boolean |
hasCustomTabRedirectActivity(android.content.Context context,
java.lang.String url)
hasCustomTabRedirectActivity - Ensures that the developer has properly configured their
AndroidManifest to expose the BrowserTabActivity.
|
static boolean |
isEmpty(java.lang.String message)
To improve test-ability with local Junit.
|
static boolean |
isScopeIntersects(java.util.Set<java.lang.String> scopes,
java.util.Set<java.lang.String> otherScopes) |
static void |
throwOnMainThread(java.lang.String methodName) |
static java.lang.String |
urlFormDecode(java.lang.String source)
Perform URL decode on the given source.
|
static java.lang.String |
urlFormEncode(java.lang.String stringToEncode)
Translate the given string into the application/x-www-form-urlencoded using the utf_8 encoding scheme(The World
Wide Web Consortium Recommendation states that UTF-8 should be used.
|
static void |
validateNonNullArg(java.lang.Object o,
java.lang.String argName)
Throws MsalArgumentException if the argument is null or empty
|
static void |
validateNonNullArgument(java.lang.Object o,
java.lang.String argName)
Throws IllegalArgumentException if the argument is null.
|
public static final java.lang.String ENCODING_UTF8
public static final int DEFAULT_EXPIRATION_TIME_SEC
public static final java.lang.String CHROME_PACKAGE
public static final java.lang.String QUERY_STRING_SYMBOL
public static final java.lang.String QUERY_STRING_DELIMITER
public static boolean isEmpty(java.lang.String message)
TextUtils.public static void validateNonNullArgument(java.lang.Object o,
java.lang.String argName)
public static void validateNonNullArg(java.lang.Object o,
java.lang.String argName)
throws MsalArgumentException
o - argName - MsalArgumentExceptionpublic static java.lang.String urlFormEncode(java.lang.String stringToEncode)
throws java.io.UnsupportedEncodingException
stringToEncode - The String to encode.java.io.UnsupportedEncodingException - If the named encoding is not supported.public static java.lang.String urlFormDecode(java.lang.String source)
throws java.io.UnsupportedEncodingException
source - The String to decode for.java.io.UnsupportedEncodingException - If encoding is not supported.public static java.util.Map<java.lang.String,java.lang.String> extractJsonObjectIntoMap(java.lang.String jsonString)
throws org.json.JSONException
org.json.JSONExceptionpublic static java.util.Date calculateExpiresOn(java.lang.String expiresIn)
expiresIn - The given expires in that is used to calculate the expires on.public static int getExpiryOrDefault(java.lang.String expiresIn)
public static java.util.Set<java.lang.String> getScopesAsSet(java.lang.String scopes)
scopes - The scopes in the format of string, delimited by " ".public static boolean hasCustomTabRedirectActivity(android.content.Context context,
java.lang.String url)
context - url - public static java.lang.String getChromePackageWithCustomTabSupport(android.content.Context context)
context - The app Context to check for the package existence.public static java.lang.String getChromePackage(android.content.Context context)
context - The app context that is used to check the chrome packages.public static java.util.Map<java.lang.String,java.lang.String> decodeUrlToMap(java.lang.String url,
java.lang.String delimiter)
url - The url to decode for.delimiter - The delimiter used to parse the url string.public static java.lang.String appendQueryParameterToUrl(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> requestParams)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic static java.lang.String base64UrlEncodeToString(java.lang.String message)
public static boolean isScopeIntersects(java.util.Set<java.lang.String> scopes,
java.util.Set<java.lang.String> otherScopes)
public static java.lang.String createHash(java.lang.String msg)
throws java.security.NoSuchAlgorithmException,
java.io.UnsupportedEncodingException
java.security.NoSuchAlgorithmExceptionjava.io.UnsupportedEncodingExceptionpublic static java.net.URL getUrl(java.lang.String endpoint)
endpoint - url as a stringpublic static java.lang.String getUniqueUserIdentifier(java.lang.String uid,
java.lang.String utid)
public static long getExpiresOn(long expiresIn)
public static android.content.pm.ApplicationInfo getApplicationInfo(android.content.Context context)
public static java.util.Set<java.lang.String> convertArrayToSet(java.lang.String[] values)
public static void throwOnMainThread(java.lang.String methodName)
methodName -