@Immutable public class UserInfoErrorResponse extends UserInfoResponse implements ErrorResponse
Standard OAuth 2.0 Bearer Token errors:
BearerTokenError.MISSING_TOKEN
BearerTokenError.INVALID_REQUEST
BearerTokenError.INVALID_TOKEN
BearerTokenError.INSUFFICIENT_SCOPE
Example HTTP response:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="example.com",
error="invalid_token",
error_description="The access token expired"
Related specifications:
| Constructor and Description |
|---|
UserInfoErrorResponse(BearerTokenError error)
Creates a new UserInfo error response.
|
| Modifier and Type | Method and Description |
|---|---|
ErrorObject |
getErrorObject()
Gets the error associated with the error response.
|
static java.util.Set<BearerTokenError> |
getStandardErrors()
Gets the standard errors for a UserInfo error response.
|
boolean |
indicatesSuccess()
Checks if the response indicates success.
|
static UserInfoErrorResponse |
parse(HTTPResponse httpResponse)
Parses a UserInfo error response from the specified HTTP response.
|
static UserInfoErrorResponse |
parse(java.lang.String wwwAuth)
Parses a UserInfo error response from the specified HTTP response
WWW-Authenticate header. |
HTTPResponse |
toHTTPResponse()
Returns the HTTP response for this UserInfo error response.
|
public UserInfoErrorResponse(BearerTokenError error)
error - The OAuth 2.0 bearer token error. Should match one of
the standard errors for a
UserInfo error response. Must not be null.public static java.util.Set<BearerTokenError> getStandardErrors()
public boolean indicatesSuccess()
ResponseindicatesSuccess in interface Responsetrue if the response indicates success, else
false.public ErrorObject getErrorObject()
ErrorResponsegetErrorObject in interface ErrorResponsenull if none.public HTTPResponse toHTTPResponse()
Example HTTP response:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="example.com",
error="invalid_token",
error_description="The access token expired"
toHTTPResponse in interface Responsepublic static UserInfoErrorResponse parse(java.lang.String wwwAuth) throws ParseException
WWW-Authenticate header.wwwAuth - The WWW-Authenticate header value to parse.
Must not be null.ParseException - If the WWW-Authenticate header value
couldn't be parsed to a UserInfo error
response.public static UserInfoErrorResponse parse(HTTPResponse httpResponse) throws ParseException
Note: The HTTP status code is not checked for matching the error code semantics.
httpResponse - The HTTP response to parse. Its status code must
not be 200 (OK). Must not be null.ParseException - If the HTTP response couldn't be parsed to a
UserInfo error response.Copyright © 2016 Connect2id Ltd.. All Rights Reserved.