Class AccountBuilder

java.lang.Object
org.shredzone.acme4j.AccountBuilder

public class AccountBuilder extends Object
A builder for registering a new account.
  • Constructor Details

  • Method Details

    • addContact

      public AccountBuilder addContact(URI contact)
      Add a contact URI to the list of contacts.
      Parameters:
      contact - Contact URI
      Returns:
      itself
    • addContact

      public AccountBuilder addContact(String contact)
      Add a contact address to the list of contacts.

      This is a convenience call for addContact(URI).

      Parameters:
      contact - Contact URI as string
      Returns:
      itself
      Throws:
      IllegalArgumentException - if there is a syntax error in the URI string
    • addEmail

      public AccountBuilder addEmail(String email)
      Add a email address to the list of contacts.

      This is a convenience call for addContact(String) that doesn't require from you attach "mailto" scheme before email address.

      Parameters:
      email - Contact email without "mailto" scheme (e.g. test@gmail.com)
      Returns:
      itself
      Throws:
      IllegalArgumentException - if there is a syntax error in the URI string
    • agreeToTermsOfService

      Signals that the user agrees to the terms of service.
      Returns:
      itself
    • onlyExisting

      Signals that only an existing account should be returned. The server will not create a new account if the key is not known. This is useful if you only have your account's key pair available, but not your account's location URL.
      Returns:
      itself
    • useKeyPair

      public AccountBuilder useKeyPair(KeyPair keyPair)
      Sets the KeyPair to be used for this account.
      Parameters:
      keyPair - Account's KeyPair
      Returns:
      itself
    • withKeyIdentifier

      Sets a Key Identifier and MAC key provided by the CA. Use this if your CA requires an individual account identification, e.g. your customer number.
      Parameters:
      kid - Key Identifier
      macKey - MAC key
      Returns:
      itself
    • withKeyIdentifier

      public AccountBuilder withKeyIdentifier(String kid, String encodedMacKey)
      Sets a Key Identifier and MAC key provided by the CA. Use this if your CA requires an individual account identification, e.g. your customer number.
      Parameters:
      kid - Key Identifier
      encodedMacKey - Base64url encoded MAC key. It will be decoded for your convenience.
      Returns:
      itself
    • create

      public Account create(Session session) throws AcmeException
      Creates a new account.
      Parameters:
      session - Session to be used for registration
      Returns:
      Account referring to the new account
      Throws:
      AcmeException
    • createLogin

      public Login createLogin(Session session) throws AcmeException
      Creates a new account.

      This method returns a ready to use Login for the new Account.

      Parameters:
      session - Session to be used for registration
      Returns:
      Login referring to the new account
      Throws:
      AcmeException