public class Challenge
extends java.lang.Object
Constructor and Description |
---|
Challenge(java.lang.String schemeName,
java.lang.String token68)
Constructs a challenge with token68 string
|
Challenge(java.lang.String schemeName,
java.lang.String realm,
java.util.Map<java.lang.String,java.lang.String> params)
Constructs a challenge with an optional realm and auth parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.util.Map<java.lang.String,java.lang.String> |
getParams()
Returns any auth parameters that form part of this challenge
excluding the realm.
|
java.lang.String |
getRealm()
Returns the authentication realm if defined.
|
java.lang.String |
getRequiredParameter(java.lang.String key)
Utility method giving a non-empty value for a named parameter
of this challenge.
|
java.net.URL |
getRequiredParameterUrl(java.lang.String key)
Utility method giving a non-null URL value
for a named parameter of this challenge.
|
java.lang.String |
getRequiredRealm()
Utility method giving a non-empty realm for this challenge.
|
java.lang.String |
getSchemeName()
Returns the authentication scheme name.
|
java.lang.String |
getToken68()
Returns the token68 value if defined.
|
int |
hashCode() |
static void |
main(java.lang.String[] args)
Will parse a WWW-Authenticate string on the command line and
print out the parsed challenges.
|
static java.util.List<Challenge> |
parseChallenges(java.lang.String challengeTxt)
Parses the content of a WWW-Authenticate header as a sequence
of RFC7235 challenges.
|
java.lang.String |
toString() |
public Challenge(java.lang.String schemeName, java.lang.String realm, java.util.Map<java.lang.String,java.lang.String> params)
schemeName
- scheme name, case insensitiverealm
- specified realm value, or nullparams
- additional parameters (excluding realm);
keys are case insensitive and will be mapped to lowerpublic Challenge(java.lang.String schemeName, java.lang.String token68)
schemeName
- scheme name, case insensitivetoken68
- token68 stringpublic java.lang.String getSchemeName()
public java.lang.String getRealm()
public java.lang.String getToken68()
public java.util.Map<java.lang.String,java.lang.String> getParams()
public java.lang.String getRequiredRealm() throws BadChallengeException
BadChallengeException
- if there is no realmpublic java.lang.String getRequiredParameter(java.lang.String key) throws BadChallengeException
key
- parameter name, case-insensitivekey
BadChallengeException
- if no value is specified
for key
public java.net.URL getRequiredParameterUrl(java.lang.String key) throws BadChallengeException
key
- parameter name, case-insensitivekey
BadChallengeException
- if no URL value is specified
for key
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static java.util.List<Challenge> parseChallenges(java.lang.String challengeTxt)
challengeTxt
- text as value of WWW-Authenticate headerpublic static void main(java.lang.String[] args)