public class Challenge extends AcmeResource
Subclasses must override acceptable(String)
so it only accepts the
own type. respond(JSONBuilder)
should be overridden to put all
required data to the response.
Modifier and Type | Field and Description |
---|---|
protected static String |
KEY_ERROR |
protected static String |
KEY_STATUS |
protected static String |
KEY_TYPE |
protected static String |
KEY_URI |
protected static String |
KEY_VALIDATED |
Constructor and Description |
---|
Challenge(Session session)
Creates a new generic
Challenge object. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptable(String type)
Checks if the type is acceptable to this challenge.
|
protected void |
authorize()
Callback that is invoked when the challenge is supposed to compute its
authorization data.
|
static <T extends Challenge> |
bind(Session session,
URL location)
Returns a
Challenge object of an existing challenge. |
Problem |
getError()
Returns the reason why the challenge failed, if returned by the server.
|
protected JSON |
getJSON()
Returns the JSON representation of the challenge data.
|
URL |
getLocation()
Returns the location
URL of the challenge. |
Status |
getStatus()
Returns the current status of the challenge.
|
String |
getType()
Returns the challenge type by name (e.g.
|
Instant |
getValidated()
Returns the validation date, if returned by the server.
|
protected void |
respond(JSONBuilder cb)
Exports the response state, as preparation for triggering the challenge.
|
void |
trigger()
Triggers this
Challenge . |
void |
unmarshall(JSON json)
Sets the challenge state to the given JSON map.
|
void |
update()
Updates the state of this challenge.
|
getSession, rebind, setLocation, setSession
protected static final String KEY_TYPE
protected static final String KEY_STATUS
protected static final String KEY_URI
protected static final String KEY_VALIDATED
protected static final String KEY_ERROR
public static <T extends Challenge> T bind(Session session, URL location) throws AcmeException
Challenge
object of an existing challenge.session
- Session
to be usedlocation
- Challenge locationChallenge
bound to this session and locationAcmeException
public URL getLocation()
URL
of the challenge.getLocation
in class AcmeResource
public Instant getValidated()
public Problem getError()
protected void respond(JSONBuilder cb)
cb
- JSONBuilder
to copy the response toprotected boolean acceptable(String type)
type
- Type to checktrue
if acceptable, false
if notpublic void unmarshall(JSON json)
json
- JSON containing the challenge dataprotected void authorize()
public void trigger() throws AcmeException
Challenge
. The ACME server is requested to validate the
response. Note that the validation is performed asynchronously by the ACME server.AcmeException
public void update() throws AcmeException
AcmeRetryAfterException
- the challenge is still being validated, and the server returned an
estimated date when the challenge will be completed. If you are polling
for the challenge to complete, you should wait for the date given in
AcmeRetryAfterException.getRetryAfter()
. Note that the
challenge status is updated even if this exception was thrown.AcmeException
Copyright © 2015–2019. All rights reserved.