public class WwwAuthenticateHeader extends Header
Header
representation of the WWW-Authenticate HTTP header.Modifier and Type | Class and Description |
---|---|
static class |
WwwAuthenticateHeader.Challenge
A single WWW-Authenticate challenge.
|
Modifier and Type | Field and Description |
---|---|
static String |
NAME
A constant for the name of the WWW-Authenticate header.
|
Constructor and Description |
---|
WwwAuthenticateHeader() |
Modifier and Type | Method and Description |
---|---|
WwwAuthenticateHeader |
addChallenge(String scheme,
String realm,
Map<String,String> parameters)
Add a new challenge.
|
WwwAuthenticateHeader |
addChallenge(WwwAuthenticateHeader.Challenge challenge)
Add a new authentication option.
|
static WwwAuthenticateHeader |
basic(String realm)
Create a basic authentication challenge header.
|
static WwwAuthenticateHeader |
bearer(String realm,
Map<String,String> parameters)
Create a bearer authentication challenge header.
|
List<WwwAuthenticateHeader.Challenge> |
getChallenges()
Return an unmodifiable view of the authentication challenges represented by this header object.
|
String |
getName()
Returns the name of the header, as it would canonically appear within an
HTTP message.
|
List<String> |
getValues()
Returns the header as a list of strings.
|
static WwwAuthenticateHeader |
valueOf(List<String> values)
Obtain a
WwwAuthenticateHeader representation of the given header values. |
static WwwAuthenticateHeader |
valueOf(Response response)
Obtain a
WwwAuthenticateHeader representation of the headers in the given response. |
equals, getFirstValue, hashCode, toString
public static final String NAME
public List<WwwAuthenticateHeader.Challenge> getChallenges()
public String getName()
Header
public List<String> getValues()
Header
String
should represent the value component of the key-value
pair that makes up the HTTP header - as such, for some Header
implementations each String in this List
may contain multiple
token-separated values.
The List
returned from this method should not be expected to be
mutable. However, some subclasses of Header
may choose to
implement it as such.
public WwwAuthenticateHeader addChallenge(String scheme, String realm, Map<String,String> parameters)
scheme
- The scheme of the authentication option.realm
- The realm of the authentication option.parameters
- Any additional options that the scheme requires.public WwwAuthenticateHeader addChallenge(WwwAuthenticateHeader.Challenge challenge)
challenge
- The authentication option.public static WwwAuthenticateHeader valueOf(Response response) throws MalformedHeaderException
WwwAuthenticateHeader
representation of the headers in the given response.response
- The response object.null
if the response
parameter is null.MalformedHeaderException
- If any of the WWW-Authenticate values cannot be parsed as such.public static WwwAuthenticateHeader valueOf(List<String> values) throws MalformedHeaderException
WwwAuthenticateHeader
representation of the given header values.values
- The header values.null
if the values
parameter is
null.MalformedHeaderException
- If any of the values cannot be parsed as a WWW-Authenticate value.public static WwwAuthenticateHeader basic(String realm)
realm
- The realm for the challenge.public static WwwAuthenticateHeader bearer(String realm, Map<String,String> parameters)
realm
- The realm for the challenge.parameters
- Additional parameters for the challenge.Copyright © 2010-2018, ForgeRock All Rights Reserved.