private Http01Challenge httpChallenge(Authorization auth) throws AcmeException { // Find a single http-01 challenge Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); if (challenge == null) { throw new AcmeException("Found no " + Http01Challenge.TYPE + " challenge, don't know what to do..."); } // Output the challenge, wait for acknowledge... log.debug("http://{}/.well-known/acme-challenge/{}", auth.getIdentifier().getDomain(), challenge.getToken()); log.debug("Content: {}", challenge.getAuthorization()); return challenge; }
contentHolder.content = challenge.getAuthorization(); if (challenge.getStatus() == Status.VALID) { return; challenge.trigger(); while (challenge.getStatus() != Status.VALID && attempts-- > 0) { if (challenge.getStatus() == Status.INVALID) { throw new AcmeException("Challenge failed... Giving up."); challenge.update(); if (challenge.getStatus() != Status.VALID) { throw new AcmeException("Failed to pass the challenge for domain " + auth.getIdentifier().getDomain() + ", ... Giving up.");
/** * Returns the token to be used for this challenge. */ @Override public String getToken() { return super.getToken(); }
public String getAuthContent() { Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); return challenge.getAuthorization(); }
public String getToken() { Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); return challenge.getToken(); }
/** * 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 in * {@link Problem#getSubProblems()}. */ @CheckForNull public Problem getError() { return getJSON().get(KEY_ERROR) .map(it -> it.asProblem(getLocation())) .orElse(null); }
/** * Returns the current status of the challenge. * <p> * Possible values are: {@link Status#PENDING}, {@link Status#PROCESSING}, * {@link Status#VALID}, {@link Status#INVALID}. */ public Status getStatus() { return getJSON().get(KEY_STATUS).asStatus(); }
/** * Returns the digest string to be set in the domain's {@code _acme-challenge} TXT * record. */ public String getDigest() { return base64UrlEncode(sha256hash(getAuthorization())); }
/** * Returns the value that is to be used as {@code acmeValidation} extension in * the test certificate. */ public byte[] getAcmeValidation() { return sha256hash(getAuthorization()); }
/** * Creates a new generic {@link Challenge} object. * * @param login * {@link Login} the resource is bound with * @param data * {@link JSON} challenge data */ public Challenge(Login login, JSON data) { super(login, data.get(KEY_URL).asURL()); setJSON(data); }
/** * Gets the token. */ protected String getToken() { String token = getJSON().get(KEY_TOKEN).asString(); if (!AcmeUtils.isValidBase64Url(token)) { throw new AcmeProtocolException("Invalid token: " + token); } return token; }
private Challenge httpChallenge(final Authorization auth) throws AcmeException { final Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); if (challenge == null) { throw new AcmeException("Challenge is null"); } challengeUpdater.accept("/.well-known/acme-challenge/" + challenge.getToken(), challenge.getAuthorization()); return challenge; }
/** * Returns the challenge type by name (e.g. "http-01"). */ public String getType() { return getJSON().get(KEY_TYPE).asString(); }
/** * Returns the token to be used for this challenge. */ @Override public String getToken() { return super.getToken(); }
/** * Returns the digest string to be set in the domain's {@code _acme-challenge} TXT * record. */ public String getDigest() { return base64UrlEncode(sha256hash(getAuthorization())); }
/** * Returns the value that is to be used as {@code acmeValidation} extension in * the test certificate. */ public byte[] getAcmeValidation() { return sha256hash(getAuthorization()); }
/** * Creates a new generic {@link Challenge} object. * * @param login * {@link Login} the resource is bound with * @param data * {@link JSON} challenge data */ public Challenge(Login login, JSON data) { super(login, data.get(KEY_URL).asURL()); setJSON(data); }
/** * Gets the token. */ protected String getToken() { String token = getJSON().get(KEY_TOKEN).asString(); if (!AcmeUtils.isValidBase64Url(token)) { throw new AcmeProtocolException("Invalid token: " + token); } return token; }
/** * Returns the challenge type by name (e.g. "http-01"). */ public String getType() { return getJSON().get(KEY_TYPE).asString(); }
/** * Returns the current status of the challenge. * <p> * Possible values are: {@link Status#PENDING}, {@link Status#PROCESSING}, * {@link Status#VALID}, {@link Status#INVALID}. */ public Status getStatus() { return getJSON().get(KEY_STATUS).asStatus(); }