001/* 002 * acme4j - Java ACME client 003 * 004 * Copyright (C) 2015 Richard "Shred" Körber 005 * http://acme4j.shredzone.org 006 * 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 013 */ 014package org.shredzone.acme4j.challenge; 015 016import java.io.Serial; 017 018import org.shredzone.acme4j.Login; 019import org.shredzone.acme4j.toolbox.JSON; 020 021/** 022 * Implements the {@value TYPE} challenge. For domain validation, it requires a specific 023 * file that can be retrieved from the domain via HTTP. See the acme4j documentation for a 024 * detailed explanation. 025 */ 026public class Http01Challenge extends TokenChallenge { 027 @Serial 028 private static final long serialVersionUID = 3322211185872544605L; 029 030 /** 031 * Challenge type name: {@value} 032 */ 033 public static final String TYPE = "http-01"; 034 035 /** 036 * Creates a new generic {@link Http01Challenge} object. 037 * 038 * @param login 039 * {@link Login} the resource is bound with 040 * @param data 041 * {@link JSON} challenge data 042 */ 043 public Http01Challenge(Login login, JSON data) { 044 super(login, data); 045 } 046 047 /** 048 * Returns the token to be used for this challenge. 049 */ 050 @Override 051 public String getToken() { 052 return super.getToken(); 053 } 054 055 @Override 056 protected boolean acceptable(String type) { 057 return TYPE.equals(type); 058 } 059 060}