/** * Returns the token to be used for this challenge. */ @Override public String getToken() { return super.getToken(); }
/** * Returns the authorization string. * <p> * The default is {@code token + '.' + base64url(jwkThumbprint)}. Subclasses may * override this method if a different algorithm is used. */ public String getAuthorization() { try { PublicKey pk = getLogin().getKeyPair().getPublic(); PublicJsonWebKey jwk = PublicJsonWebKey.Factory.newPublicJwk(pk); return getToken() + '.' + base64UrlEncode(jwk.calculateThumbprint("SHA-256")); } catch (JoseException ex) { throw new AcmeProtocolException("Cannot compute key thumbprint", ex); } }
/** * 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; }
/** * {@inheritDoc} * <p> * This implementation handles the standard challenge types. For unknown types, * generic {@link Challenge} or {@link TokenChallenge} instances are created. * <p> * Custom provider implementations may override this method to provide challenges that * are unique to the provider. */ @Override public Challenge createChallenge(Login login, JSON data) { Objects.requireNonNull(login, "login"); Objects.requireNonNull(data, "data"); String type = data.get("type").asString(); BiFunction<Login, JSON, Challenge> constructor = CHALLENGES.get(type); if (constructor != null) { return constructor.apply(login, data); } if (data.contains("token")) { return new TokenChallenge(login, data); } else { return new Challenge(login, data); } }
/** * Returns the authorization string. * <p> * The default is {@code token + '.' + base64url(jwkThumbprint)}. Subclasses may * override this method if a different algorithm is used. */ public String getAuthorization() { try { PublicKey pk = getLogin().getKeyPair().getPublic(); PublicJsonWebKey jwk = PublicJsonWebKey.Factory.newPublicJwk(pk); return getToken() + '.' + base64UrlEncode(jwk.calculateThumbprint("SHA-256")); } catch (JoseException ex) { throw new AcmeProtocolException("Cannot compute key thumbprint", ex); } }
/** * 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; }
/** * {@inheritDoc} * <p> * This implementation handles the standard challenge types. For unknown types, * generic {@link Challenge} or {@link TokenChallenge} instances are created. * <p> * Custom provider implementations may override this method to provide challenges that * are unique to the provider. */ @Override public Challenge createChallenge(Login login, JSON data) { Objects.requireNonNull(login, "login"); Objects.requireNonNull(data, "data"); String type = data.get("type").asString(); BiFunction<Login, JSON, Challenge> constructor = CHALLENGES.get(type); if (constructor != null) { return constructor.apply(login, data); } if (data.contains("token")) { return new TokenChallenge(login, data); } else { return new Challenge(login, data); } }
/** * Returns the token to be used for this challenge. */ @Override public String getToken() { return super.getToken(); }