- java.lang.Object
-
- org.shredzone.acme4j.AcmeResource
-
- org.shredzone.acme4j.AcmeJsonResource
-
- org.shredzone.acme4j.Account
-
- All Implemented Interfaces:
Serializable
public class Account extends AcmeJsonResource
A representation of an account at the ACME server.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Account.EditableAccount
Provides editable properties of anAccount
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeKey(KeyPair newKeyPair)
Changes theKeyPair
associated with the account.void
deactivate()
Permanently deactivates an account.List<URI>
getContacts()
List of registered contact addresses (emails, phone numbers etc).Optional<String>
getKeyIdentifier()
Returns the key identifier of the external non-ACME account.Iterator<Order>
getOrders()
Status
getStatus()
Returns the current status of the account.Optional<Boolean>
getTermsOfServiceAgreed()
Returns if the user agreed to the terms of service.boolean
hasExternalAccountBinding()
Returnstrue
if the account is bound to an external non-ACME account.Account.EditableAccount
modify()
Modifies the account data of the account.OrderBuilder
newOrder()
Creates a builder for a newOrder
.Authorization
preAuthorize(Identifier identifier)
Pre-authorizes anIdentifier
.Authorization
preAuthorizeDomain(String domain)
Pre-authorizes a domain.-
Methods inherited from class org.shredzone.acme4j.AcmeJsonResource
fetch, getJSON, getRetryAfter, invalidate, isValid, setJSON, setRetryAfter, update
-
Methods inherited from class org.shredzone.acme4j.AcmeResource
finalize, getLocation, getLogin, getSession, rebind
-
-
-
-
Method Detail
-
getTermsOfServiceAgreed
public Optional<Boolean> getTermsOfServiceAgreed()
Returns if the user agreed to the terms of service.- Returns:
true
if the user agreed to the terms of service. May be empty if the server did not provide such an information.
-
getContacts
public List<URI> getContacts()
List of registered contact addresses (emails, phone numbers etc).This list is unmodifiable. Use
modify()
to change the contacts. May be empty, but is nevernull
.
-
getStatus
public Status getStatus()
Returns the current status of the account.Possible values are:
Status.VALID
,Status.DEACTIVATED
,Status.REVOKED
.
-
hasExternalAccountBinding
public boolean hasExternalAccountBinding()
Returnstrue
if the account is bound to an external non-ACME account.- Since:
- 2.8
-
getKeyIdentifier
public Optional<String> getKeyIdentifier()
Returns the key identifier of the external non-ACME account. If this account is not bound to an external account, the result is empty.- Since:
- 2.8
-
getOrders
public Iterator<Order> getOrders()
Returns anIterator
of allOrder
belonging to thisAccount
.Using the iterator will initiate one or more requests to the ACME server.
- Returns:
Iterator
instance that returnsOrder
objects in no specific sorting order.Iterator.hasNext()
andIterator.next()
may throwAcmeProtocolException
if a batch of authorization URIs could not be fetched from the server.
-
newOrder
public OrderBuilder newOrder()
Creates a builder for a newOrder
.- Returns:
OrderBuilder
object
-
preAuthorizeDomain
public Authorization preAuthorizeDomain(String domain) throws AcmeException
Pre-authorizes a domain. The CA will check if it accepts the domain for certification, and returns the necessary challenges.Some servers may not allow pre-authorization.
It is not possible to pre-authorize wildcard domains.
- Parameters:
domain
- Domain name to be pre-authorized. IDN names are accepted and will be ACE encoded automatically.- Returns:
Authorization
object for this domain- Throws:
AcmeException
- if the server does not allow pre-authorizationAcmeServerException
- if the server allows pre-authorization, but will refuse to issue a certificate for this domain
-
preAuthorize
public Authorization preAuthorize(Identifier identifier) throws AcmeException
Pre-authorizes anIdentifier
. The CA will check if it accepts the identifier for certification, and returns the necessary challenges.Some servers may not allow pre-authorization.
It is not possible to pre-authorize wildcard domains.
- Parameters:
identifier
-Identifier
to be pre-authorized.- Returns:
Authorization
object for this identifier- Throws:
AcmeException
- if the server does not allow pre-authorizationAcmeServerException
- if the server allows pre-authorization, but will refuse to issue a certificate for this identifier- Since:
- 2.3
-
changeKey
public void changeKey(KeyPair newKeyPair) throws AcmeException
Changes theKeyPair
associated with the account.After a successful call, the new key pair is already set in the associated
Login
. The old key pair can be discarded.- Parameters:
newKeyPair
- newKeyPair
to be used for identifying this account- Throws:
AcmeException
-
deactivate
public void deactivate() throws AcmeException
Permanently deactivates an account. Related certificates may still be valid after account deactivation, and need to be revoked separately if neccessary.A deactivated account cannot be reactivated!
- Throws:
AcmeException
-
modify
public Account.EditableAccount modify()
Modifies the account data of the account.- Returns:
Account.EditableAccount
where the account can be modified
-
-