public final class OAuthUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTH_SCHEME |
static java.lang.String |
MULTIPART |
Constructor and Description |
---|
OAuthUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
decodeClientAuthenticationHeader(java.lang.String authenticationHeader)
Decodes the Basic Authentication header into a username and password
|
static java.util.Map<java.lang.String,java.lang.Object> |
decodeForm(java.lang.String form)
Parse a form-urlencoded document.
|
static java.util.Map<java.lang.String,java.lang.String> |
decodeOAuthHeader(java.lang.String header) |
static java.lang.String |
decodePercent(java.lang.String s) |
static java.util.Set<java.lang.String> |
decodeScopes(java.lang.String s) |
static java.lang.String |
encodeAuthorizationBearerHeader(java.util.Map<java.lang.String,java.lang.Object> entries)
Construct an Authorization Bearer header
|
static java.lang.String |
encodeOAuthHeader(java.util.Map<java.lang.String,java.lang.Object> entries)
Construct a WWW-Authenticate header
|
static java.lang.String |
encodeScopes(java.util.Set<java.lang.String> s) |
static java.lang.String |
format(java.util.Collection<? extends java.util.Map.Entry<java.lang.String,java.lang.Object>> parameters,
java.lang.String encoding)
Translates parameters into
application/x-www-form-urlencoded String |
static java.lang.String |
getAuthHeaderField(java.lang.String authHeader) |
static java.lang.String |
getAuthzMethod(java.lang.String header) |
static OAuthProblemException |
handleBadContentTypeException(java.lang.String expectedContentType) |
static OAuthProblemException |
handleMissingParameters(java.util.Set<java.lang.String> missingParams)
Creates OAuthProblemException that contains set of missing oauth parameters
|
static OAuthProblemException |
handleNotAllowedParametersOAuthException(java.util.List<java.lang.String> notAllowedParams) |
static OAuthProblemException |
handleOAuthProblemException(java.lang.String message)
Creates invalid_request exception with given message
|
static boolean |
hasContentType(java.lang.String requestContentType,
java.lang.String requiredContentType) |
static boolean |
hasEmptyValues(java.lang.String[] array) |
static <T> T |
instantiateClass(java.lang.Class<T> clazz) |
static <T> T |
instantiateClassWithParameters(java.lang.Class<T> clazz,
java.lang.Class<?>[] paramsTypes,
java.lang.Object[] paramValues) |
static boolean |
isEmpty(java.lang.String value) |
static boolean |
isFormEncoded(java.lang.String contentType)
Return true if the given Content-Type header means FORM_ENCODED.
|
static boolean |
isMultipart(HttpServletRequest request) |
static java.lang.String |
percentEncode(java.lang.Iterable values)
Construct a &-separated list of the given values, percentEncoded.
|
static java.lang.String |
percentEncode(java.lang.String s) |
static java.lang.String |
saveStreamAsString(java.io.InputStream is)
Read data from Input Stream and save it as a String.
|
static java.lang.String |
toString(java.io.InputStream is,
java.lang.String defaultCharset)
Get the entity content as a String, using the provided default character set
if none is found in the entity.
|
public static final java.lang.String AUTH_SCHEME
public static final java.lang.String MULTIPART
public static java.lang.String format(java.util.Collection<? extends java.util.Map.Entry<java.lang.String,java.lang.Object>> parameters, java.lang.String encoding)
application/x-www-form-urlencoded
Stringparameters
- parameters to encodeencoding
- The name of a supported
character
encoding.public static java.lang.String saveStreamAsString(java.io.InputStream is) throws java.io.IOException
is
- InputStream to be readjava.io.IOException
public static java.lang.String toString(java.io.InputStream is, java.lang.String defaultCharset) throws java.io.IOException
is
- input stream to be saved as stringdefaultCharset
- character set to be applied if none found in the entityjava.lang.IllegalArgumentException
- if entity is null or if content length > Integer.MAX_VALUEjava.io.IOException
- if an error occurs reading the input streampublic static OAuthProblemException handleOAuthProblemException(java.lang.String message)
message
- error messagepublic static OAuthProblemException handleMissingParameters(java.util.Set<java.lang.String> missingParams)
missingParams
- missing oauth parameterspublic static OAuthProblemException handleBadContentTypeException(java.lang.String expectedContentType)
public static OAuthProblemException handleNotAllowedParametersOAuthException(java.util.List<java.lang.String> notAllowedParams)
public static java.util.Map<java.lang.String,java.lang.Object> decodeForm(java.lang.String form)
public static boolean isFormEncoded(java.lang.String contentType)
public static java.lang.String decodePercent(java.lang.String s)
public static java.lang.String percentEncode(java.lang.Iterable values)
public static java.lang.String percentEncode(java.lang.String s)
public static <T> T instantiateClass(java.lang.Class<T> clazz) throws OAuthSystemException
OAuthSystemException
public static <T> T instantiateClassWithParameters(java.lang.Class<T> clazz, java.lang.Class<?>[] paramsTypes, java.lang.Object[] paramValues) throws OAuthSystemException
OAuthSystemException
public static java.lang.String getAuthHeaderField(java.lang.String authHeader)
public static java.util.Map<java.lang.String,java.lang.String> decodeOAuthHeader(java.lang.String header)
public static java.lang.String[] decodeClientAuthenticationHeader(java.lang.String authenticationHeader)
authenticationHeader
- String
containing the encoded header value.
e.g. "Basic dXNlcm5hbWU6cGFzc3dvcmQ="String[]
if the header could be decoded into a non null username and password or null.public static java.lang.String encodeOAuthHeader(java.util.Map<java.lang.String,java.lang.Object> entries)
public static java.lang.String encodeAuthorizationBearerHeader(java.util.Map<java.lang.String,java.lang.Object> entries)
public static boolean isEmpty(java.lang.String value)
public static boolean hasEmptyValues(java.lang.String[] array)
public static java.lang.String getAuthzMethod(java.lang.String header)
public static java.util.Set<java.lang.String> decodeScopes(java.lang.String s)
public static java.lang.String encodeScopes(java.util.Set<java.lang.String> s)
public static boolean isMultipart(HttpServletRequest request)
public static boolean hasContentType(java.lang.String requestContentType, java.lang.String requiredContentType)
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"