Package com.nimbusds.oauth2.sdk.token
Class TokenSchemeError
java.lang.Object
com.nimbusds.oauth2.sdk.ErrorObject
com.nimbusds.oauth2.sdk.token.TokenSchemeError
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BearerTokenError,DPoPTokenError
The base abstract class for token scheme errors. Concrete extending classes
should be immutable.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTokenSchemeError(AccessTokenType scheme, String code, String description, int httpStatusCode, URI uri, String realm, Scope scope) Creates a new token error with the specified code, description, HTTP status code, page URI, realm and scope. -
Method Summary
Modifier and TypeMethodDescriptionabstract TokenSchemeErrorappendDescription(String text) Appends the specified text to the error description.getRealm()Returns the realm.Returns the token scheme.getScope()Returns the required scope.static booleanisScopeWithValidChars(Scope scope) Returnstrueif the specified scope consists of valid characters.abstract TokenSchemeErrorsetDescription(String description) Sets the error description.abstract TokenSchemeErrorsetHTTPStatusCode(int httpStatusCode) Sets the HTTP status code.abstract TokenSchemeErrorSets the realm.abstract TokenSchemeErrorSets the required scope.abstract TokenSchemeErrorSets the error page URI.Returns theWWW-AuthenticateHTTP response header code for this token scheme error.Methods inherited from class com.nimbusds.oauth2.sdk.ErrorObject
equals, getCode, getCustomParams, getDescription, getHTTPStatusCode, getURI, hashCode, isLegal, isLegal, parse, parse, parse, removeIllegalChars, setCustomParams, toHTTPResponse, toJSONObject, toParameters, toString
-
Constructor Details
-
TokenSchemeError
protected TokenSchemeError(AccessTokenType scheme, String code, String description, int httpStatusCode, URI uri, String realm, Scope scope) Creates a new token error with the specified code, description, HTTP status code, page URI, realm and scope.- Parameters:
scheme- The token scheme. Must not benull.code- The error code,nullif not specified.description- The error description,nullif not specified.httpStatusCode- The HTTP status code, zero if not specified.uri- The error page URI,nullif not specified.realm- The realm,nullif not specified.scope- The required scope,nullif not specified.
-
-
Method Details
-
isScopeWithValidChars
Returnstrueif the specified scope consists of valid characters. Values for the "scope" attributes must not include characters outside the [0x20, 0x21] | [0x23 - 0x5B] | [0x5D - 0x7E] range. See RFC 6750, section 3.- Parameters:
scope- The scope.- Returns:
trueif the scope contains valid characters, elsefalse.- See Also:
-
getScheme
Returns the token scheme.- Returns:
- The token scheme.
-
getRealm
Returns the realm.- Returns:
- The realm,
nullif not specified.
-
getScope
Returns the required scope.- Returns:
- The required scope,
nullif not specified.
-
setDescription
Description copied from class:ErrorObjectSets the error description.- Overrides:
setDescriptionin classErrorObject- Parameters:
description- The error description,nullif not specified.- Returns:
- A copy of this error with the specified description.
-
appendDescription
Description copied from class:ErrorObjectAppends the specified text to the error description.- Overrides:
appendDescriptionin classErrorObject- Parameters:
text- The text to append to the error description,nullif not specified.- Returns:
- A copy of this error with the specified appended description.
-
setHTTPStatusCode
Description copied from class:ErrorObjectSets the HTTP status code.- Overrides:
setHTTPStatusCodein classErrorObject- Parameters:
httpStatusCode- The HTTP status code, zero if not specified.- Returns:
- A copy of this error with the specified HTTP status code.
-
setURI
Description copied from class:ErrorObjectSets the error page URI.- Overrides:
setURIin classErrorObject- Parameters:
uri- The error page URI,nullif not specified.- Returns:
- A copy of this error with the specified page URI.
-
setRealm
Sets the realm.- Parameters:
realm- realm,nullif not specified.- Returns:
- A copy of this error with the specified realm.
-
setScope
Sets the required scope.- Parameters:
scope- The required scope,nullif not specified.- Returns:
- A copy of this error with the specified required scope.
-
toWWWAuthenticateHeader
Returns theWWW-AuthenticateHTTP response header code for this token scheme error.Example:
Bearer realm="example.com", error="invalid_token", error_description="Invalid access token"
- Returns:
- The
Www-Authenticateheader value.
-