Class WwwAuthenticate.Builder
- Enclosing class:
- WwwAuthenticate
Composes the param(String, String) is a generic escape hatch so new params never require an API change. The scheme
presets (basic(String) / bearer() / digest()) overwrite the scheme; auth-param setters
overwrite a previously-set param of the same name while preserving its original position.
Example:
String
See Also:
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets thealgorithm auth-param (rendered as a bare token, unquoted).Sets the scheme toBasic and therealm auth-param.bearer()Sets the scheme toBearer .build()Builds the renderedWWW-Authenticate challenge value.Sets thecharset auth-param (rendered as a quoted-string).digest()Sets the scheme toDigest .Sets thedomain auth-param to a space-separated, quoted list of URIs.Sets theerror auth-param (rendered as a quoted-string; RFC 6750 Bearer).errorDescription(String value) Sets theerror_description auth-param (rendered as a quoted-string; RFC 6750 Bearer).Sets thenonce auth-param (rendered as a quoted-string).Sets theopaque auth-param (rendered as a quoted-string).Generic escape hatch for setting any auth-param by name, rendered as a quoted-string.Sets theqop auth-param to a comma-separated, quoted list of quality-of-protection tokens.Sets therealm auth-param (rendered as a quoted-string).Sets the authentication scheme (e.g.stale(boolean value) Sets thestale auth-param (rendered as a bare token, unquoted).toHeader()Builds aWwwAuthenticateheader bean directly from this builder.toString()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
scheme
Sets the authentication scheme (e.g."Basic" ,"Bearer" ,"Digest" ).- Parameters:
value- The scheme name. Must not benull or blank.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueisnull or blank.
-
basic
Sets the scheme toBasic and therealm auth-param.- Parameters:
realm- The protection space realm. Must not benull .- Returns:
- This object.
-
bearer
Sets the scheme toBearer .- Returns:
- This object.
-
digest
Sets the scheme toDigest .- Returns:
- This object.
-
realm
Sets therealm auth-param (rendered as a quoted-string).- Parameters:
value- The realm value. Must not benull .- Returns:
- This object.
-
charset
Sets thecharset auth-param (rendered as a quoted-string).- Parameters:
value- The charset (e.g."UTF-8" ). Must not benull .- Returns:
- This object.
-
qop
Sets theqop auth-param to a comma-separated, quoted list of quality-of-protection tokens.- Parameters:
values- The qop tokens (e.g."auth" ,"auth-int" ). Must not benull .- Returns:
- This object.
-
nonce
Sets thenonce auth-param (rendered as a quoted-string).- Parameters:
value- The server nonce. Must not benull .- Returns:
- This object.
-
opaque
Sets theopaque auth-param (rendered as a quoted-string).- Parameters:
value- The opaque value to be echoed back by the client. Must not benull .- Returns:
- This object.
-
algorithm
Sets thealgorithm auth-param (rendered as a bare token, unquoted).- Parameters:
value- The algorithm (e.g."MD5" ,"SHA-256" ). Must not benull .- Returns:
- This object.
-
domain
Sets thedomain auth-param to a space-separated, quoted list of URIs.- Parameters:
values- The protection space URIs. Must not benull .- Returns:
- This object.
-
stale
Sets thestale auth-param (rendered as a bare token, unquoted).- Parameters:
value-true if the previous request's nonce was stale.- Returns:
- This object.
-
error
Sets theerror auth-param (rendered as a quoted-string; RFC 6750 Bearer).- Parameters:
value- The error code (e.g."invalid_token" ). Must not benull .- Returns:
- This object.
-
errorDescription
Sets theerror_description auth-param (rendered as a quoted-string; RFC 6750 Bearer).- Parameters:
value- The human-readable error description. Must not benull .- Returns:
- This object.
-
param
Generic escape hatch for setting any auth-param by name, rendered as a quoted-string.Replaces any previously-registered value for the same param while preserving its original position.
- Parameters:
name- The auth-param name. Must not benull or blank.value- The auth-param value (quoted automatically). Must not benull .- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifnameisnull or blank.
-
build
Builds the renderedWWW-Authenticate challenge value.Returns an empty string when no scheme or params have been registered.
- Returns:
- The header value. Never
null .
-
toHeader
Builds aWwwAuthenticateheader bean directly from this builder.- Returns:
- A
WwwAuthenticatecarryingbuild(). Nevernull .
-
toString
-