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.
021 */
022public class Http01Challenge extends TokenChallenge {
023    private static final long serialVersionUID = 3322211185872544605L;
024
025    /**
026     * Challenge type name: {@value}
027     */
028    public static final String TYPE = "http-01";
029
030    /**
031     * Creates a new generic {@link Http01Challenge} object.
032     *
033     * @param login
034     *            {@link Login} the resource is bound with
035     * @param data
036     *            {@link JSON} challenge data
037     */
038    public Http01Challenge(Login login, JSON data) {
039        super(login, data);
040    }
041
042    /**
043     * Returns the token to be used for this challenge.
044     */
045    @Override
046    public String getToken() {
047        return super.getToken();
048    }
049
050    @Override
051    protected boolean acceptable(String type) {
052        return TYPE.equals(type);
053    }
054
055}