mirror of https://github.com/shred/acme4j
added bindChallenge
parent
0343a81a9f
commit
3426ea4ea2
|
@ -123,6 +123,18 @@ public class Login {
|
||||||
return new Order(this, requireNonNull(location, "location"));
|
return new Order(this, requireNonNull(location, "location"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of {@link Challenge} and binds it to this login.
|
||||||
|
*
|
||||||
|
* @param location
|
||||||
|
* Location URL of the challenge
|
||||||
|
* @return
|
||||||
|
* {@link Challenge} bound to the login
|
||||||
|
*/
|
||||||
|
public Challenge bindChallenge(URL location) {
|
||||||
|
return new Challenge(this, requireNonNull(location, "location"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link Challenge} instance for the given challenge data.
|
* Creates a {@link Challenge} instance for the given challenge data.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
package org.shredzone.acme4j.challenge;
|
package org.shredzone.acme4j.challenge;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import javax.annotation.CheckForNull;
|
import javax.annotation.CheckForNull;
|
||||||
|
@ -51,6 +52,11 @@ public class Challenge extends AcmeJsonResource {
|
||||||
protected static final String KEY_VALIDATED = "validated";
|
protected static final String KEY_VALIDATED = "validated";
|
||||||
protected static final String KEY_ERROR = "error";
|
protected static final String KEY_ERROR = "error";
|
||||||
|
|
||||||
|
public Challenge(Login login, URL location) {
|
||||||
|
super(login, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new generic {@link Challenge} object.
|
* Creates a new generic {@link Challenge} object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -83,6 +83,11 @@ public class LoginTest {
|
||||||
assertThat(order, is(notNullValue()));
|
assertThat(order, is(notNullValue()));
|
||||||
assertThat(order.getLogin(), is(login));
|
assertThat(order.getLogin(), is(login));
|
||||||
assertThat(order.getLocation(), is(resourceUrl));
|
assertThat(order.getLocation(), is(resourceUrl));
|
||||||
|
|
||||||
|
Challenge challenge = login.bindChallenge(resourceUrl);
|
||||||
|
assertThat(challenge, is(notNullValue()));
|
||||||
|
assertThat(challenge.getLogin(), is(login));
|
||||||
|
assertThat(challenge.getLocation(), is(resourceUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue