Package com.nimbusds.openid.connect.sdk
Class UserInfoErrorResponse
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.UserInfoResponse
-
- com.nimbusds.openid.connect.sdk.UserInfoErrorResponse
-
- All Implemented Interfaces:
ErrorResponse,Message,Response
@Immutable public class UserInfoErrorResponse extends UserInfoResponse implements ErrorResponse
UserInfo error response.Standard OAuth 2.0 Bearer Token errors:
BearerTokenError.MISSING_TOKENBearerTokenError.INVALID_REQUESTBearerTokenError.INVALID_TOKENBearerTokenError.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:
- OpenID Connect Core 1.0, section 5.3.3.
- OAuth 2.0 Bearer Token Usage (RFC 6750), section 3.1.
-
-
Constructor Summary
Constructors Constructor Description UserInfoErrorResponse(ErrorObject error)Creates a new UserInfo error response indicating a general error.UserInfoErrorResponse(BearerTokenError error)Creates a new UserInfo error response indicating a bearer token error.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ErrorObjectgetErrorObject()Gets the error associated with the error response.static Set<BearerTokenError>getStandardErrors()Gets the standard errors for a UserInfo error response.booleanindicatesSuccess()Checks if the response indicates success.static UserInfoErrorResponseparse(HTTPResponse httpResponse)Parses a UserInfo error response from the specified HTTP response.static UserInfoErrorResponseparse(String wwwAuth)Parses a UserInfo error response from the specified HTTP responseWWW-Authenticateheader.HTTPResponsetoHTTPResponse()Returns the HTTP response for this UserInfo error response.-
Methods inherited from class com.nimbusds.openid.connect.sdk.UserInfoResponse
toErrorResponse, toSuccessResponse
-
-
-
-
Constructor Detail
-
UserInfoErrorResponse
public UserInfoErrorResponse(BearerTokenError error)
Creates a new UserInfo error response indicating a bearer token error.- Parameters:
error- The OAuth 2.0 bearer token error. Should match one of thestandard errorsfor a UserInfo error response. Must not benull.
-
UserInfoErrorResponse
public UserInfoErrorResponse(ErrorObject error)
Creates a new UserInfo error response indicating a general error.- Parameters:
error- The error. Must not benull.
-
-
Method Detail
-
getStandardErrors
public static Set<BearerTokenError> getStandardErrors()
Gets the standard errors for a UserInfo error response.- Returns:
- The standard errors, as a read-only set.
-
indicatesSuccess
public boolean indicatesSuccess()
Description copied from interface:ResponseChecks if the response indicates success.- Specified by:
indicatesSuccessin interfaceResponse- Returns:
trueif the response indicates success, elsefalse.
-
getErrorObject
public ErrorObject getErrorObject()
Description copied from interface:ErrorResponseGets the error associated with the error response.- Specified by:
getErrorObjectin interfaceErrorResponse- Returns:
- The error,
nullif none.
-
toHTTPResponse
public HTTPResponse toHTTPResponse()
Returns the HTTP response for this UserInfo error response.Example HTTP response:
HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer realm="example.com", error="invalid_token", error_description="The access token expired"- Specified by:
toHTTPResponsein interfaceResponse- Returns:
- The HTTP response matching this UserInfo error response.
-
parse
public static UserInfoErrorResponse parse(String wwwAuth) throws ParseException
Parses a UserInfo error response from the specified HTTP responseWWW-Authenticateheader.- Parameters:
wwwAuth- TheWWW-Authenticateheader value to parse. Must not benull.- Returns:
- The UserInfo error response.
- Throws:
ParseException- If theWWW-Authenticateheader value couldn't be parsed to a UserInfo error response.
-
parse
public static UserInfoErrorResponse parse(HTTPResponse httpResponse) throws ParseException
Parses a UserInfo error response from the specified HTTP response.Note: The HTTP status code is not checked for matching the error code semantics.
- Parameters:
httpResponse- The HTTP response to parse. Its status code must not be 200 (OK). Must not benull.- Returns:
- The UserInfo error response.
- Throws:
ParseException- If the HTTP response couldn't be parsed to a UserInfo error response.
-
-