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 org.shredzone.acme4j.Login; 017import org.shredzone.acme4j.toolbox.JSON; 018 019/** 020 * Implements the {@value TYPE} challenge. For domain validation, it requires a specific 021 * file that can be retrieved from the domain via HTTP. See the acme4j documentation for a 022 * detailed explanation. 023 */ 024public class Http01Challenge extends TokenChallenge { 025 private static final long serialVersionUID = 3322211185872544605L; 026 027 /** 028 * Challenge type name: {@value} 029 */ 030 public static final String TYPE = "http-01"; 031 032 /** 033 * Creates a new generic {@link Http01Challenge} object. 034 * 035 * @param login 036 * {@link Login} the resource is bound with 037 * @param data 038 * {@link JSON} challenge data 039 */ 040 public Http01Challenge(Login login, JSON data) { 041 super(login, data); 042 } 043 044 /** 045 * Returns the token to be used for this challenge. 046 */ 047 @Override 048 public String getToken() { 049 return super.getToken(); 050 } 051 052 @Override 053 protected boolean acceptable(String type) { 054 return TYPE.equals(type); 055 } 056 057}