Search in sources :

Example 1 with Login

use of org.shredzone.acme4j.Login in project webpieces by deanhiller.

the class AcmeClientProxy method placeOrder.

// TODO: Put the remote request INTO a different pool to not hold up the webserver main
// threadpool so only synchronous requests will hold up synchronous requests
/**
 * @return The list of challenges with tokens to create webpages for that remote end will call to verify we own the domain
 */
public XFuture<ProxyOrder> placeOrder(URL accountUrl, KeyPair accountKeyPair) {
    try {
        log.info("reestablish account from location=" + accountUrl + " and keypair");
        Session session = new Session("acme://letsencrypt.org/staging");
        Login login = session.login(accountUrl, accountKeyPair);
        Account account = login.getAccount();
        log.info("create an order");
        String domainTemp = "something.com";
        Order order = account.newOrder().domain(domainTemp).create();
        checkAuthStatii(order);
        List<ProxyAuthorization> auths = new ArrayList<>();
        for (Authorization auth : order.getAuthorizations()) auths.add(new ProxyAuthorization(auth));
        return XFuture.completedFuture(new ProxyOrder(order, auths));
    } catch (AcmeException e) {
        throw SneakyThrow.sneak(e);
    }
}
Also used : Order(org.shredzone.acme4j.Order) Authorization(org.shredzone.acme4j.Authorization) Account(org.shredzone.acme4j.Account) AcmeException(org.shredzone.acme4j.exception.AcmeException) ArrayList(java.util.ArrayList) Login(org.shredzone.acme4j.Login) Session(org.shredzone.acme4j.Session)

Aggregations

ArrayList (java.util.ArrayList)1 Account (org.shredzone.acme4j.Account)1 Authorization (org.shredzone.acme4j.Authorization)1 Login (org.shredzone.acme4j.Login)1 Order (org.shredzone.acme4j.Order)1 Session (org.shredzone.acme4j.Session)1 AcmeException (org.shredzone.acme4j.exception.AcmeException)1