java.lang.Object
org.shredzone.acme4j.AcmeResource
org.shredzone.acme4j.AcmeJsonResource
org.shredzone.acme4j.challenge.Challenge
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
TokenChallenge
A generic challenge. It can be used as a base class for actual challenge
implementations, but it is also used if the ACME server offers a proprietary challenge
that is unknown to acme4j.
Subclasses must override acceptable(String)
so it only accepts the
own type. prepareResponse(JSONBuilder)
should be overridden to put
all required data to the response.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
acceptable
(String type) Checks if the type is acceptable to this challenge.getError()
Returns a reason why the challenge has failed in the past, if returned by the server.Returns the current status of the challenge.getType()
Returns the challenge type by name (e.g.Returns the validation date, if returned by the server.protected void
prepareResponse
(JSONBuilder response) Exports the response state, as preparation for triggering the challenge.protected void
Sets the JSON representation of the resource data.void
trigger()
Triggers thisChallenge
.Methods inherited from class org.shredzone.acme4j.AcmeJsonResource
getJSON, invalidate, isValid, update
Methods inherited from class org.shredzone.acme4j.AcmeResource
getLocation, getLogin, getSession, rebind
-
Field Details
-
KEY_TYPE
- See Also:
-
KEY_URL
- See Also:
-
KEY_STATUS
- See Also:
-
KEY_VALIDATED
- See Also:
-
KEY_ERROR
- See Also:
-
-
Constructor Details
-
Method Details
-
getType
Returns the challenge type by name (e.g. "http-01"). -
getStatus
Returns the current status of the challenge.Possible values are:
Status.PENDING
,Status.PROCESSING
,Status.VALID
,Status.INVALID
. -
getValidated
Returns the validation date, if returned by the server. -
getError
Returns a reason why the challenge has failed in the past, if returned by the server. If there are multiple errors, they can be found inProblem.getSubProblems()
. -
prepareResponse
Exports the response state, as preparation for triggering the challenge.- Parameters:
response
-JSONBuilder
to write the response to
-
acceptable
Checks if the type is acceptable to this challenge.- Parameters:
type
- Type to check- Returns:
true
if acceptable,false
if not
-
setJSON
Description copied from class:AcmeJsonResource
Sets the JSON representation of the resource data.- Overrides:
setJSON
in classAcmeJsonResource
- Parameters:
json
- NewJSON
data, must not benull
.
-
trigger
Triggers thisChallenge
. The ACME server is requested to validate the response. Note that the validation is performed asynchronously by the ACME server.If this method is invoked a second time, the ACME server is requested to retry the validation. This can be useful if the client state has changed, for example after a firewall rule has been updated.
- Throws:
AcmeException
-