Package com.iizix.server.acme
Class LetsEncryptDomain
- All Implemented Interfaces:
EventListener
,IGProp<GProp<?>[]>
,IPropCnr
,Cloneable
- Direct Known Subclasses:
EditorLetsEncryptDomain
Property container holding information about a Let's Encrypt domain with automatic certificate renewal in the server.
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The alias for the certificate.static final String
Flag for auto-accept.static final String
The type of challenge: HTTP or DNS.static final String
Default password for keystore.static final String
The number of days before certificate expiration when a new certificate is requested from Let's Encrypt.static final String
The PKCS#12 identity password.static final String
The PKCS#12 identity.static final String
The URI of the Terms-of-Service for Let's Encrypt that must be accepted.static final String
The URI of the Terms-of-Service for Let's Encrypt that has been accepted.Fields inherited from class com.iizix.prop.PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_ID
Fields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2
Fields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
Constructor Summary
ConstructorDescriptionCreates the port configuration without a name.LetsEncryptDomain
(Atom atom) Creates the port configuration with a name.Method Summary
Modifier and TypeMethodDescriptionboolean
Called to accept a Terms-of-Service agreement.void
addConnectorReference
(PortConfig config) Adds a Jetty HTTP connector that references this domain.clone()
Creates a clone out of this property.Gets the type of challenge: HTTP or DNS.Gets the description of the port configuration.Gets the domain name.Gets the expiration date of the identities first certificate alias.int
Gets the number of days before certificate expiration when a new certificate is requested from Let's Encrypt.Gets the KeyStore from a PKCS#12 identity property and password.getKeyStore
(StringBuilder pwReturn) Gets the KeyStore from a PKCS#12 identity property and password.Gets the KeyStore password.Gets the Terms-of-Service agreement URI that needs to be accepted.Gets the certificate renewal instance.Gets the current Terms-of-Service agreement URIboolean
Returns the auto-accept Terms-of-Service agreement flag.void
onEventSelf
(GEvent event) Change of password or keystore invalidates the existing keystore cached.boolean
Gets the Terms-of-Service agreement URI that needs to be accepted.void
startRenewal
(ServerShell server) Starts the renewal processing for the server.boolean
updateIdentity
(File file, String password) Updates the PKCS#12 identity from a file.Methods inherited from class com.iizix.prop.PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropDispose, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualize
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warning
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.prop.IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, isSibling, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warning
Methods inherited from interface com.iizix.prop.IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Field Details
ID_PKCS12
The PKCS#12 identity.- See Also:
ID_PASSWORD
The PKCS#12 identity password.- See Also:
EXPIRE_DAYS
The number of days before certificate expiration when a new certificate is requested from Let's Encrypt.- See Also:
TOS_URI
The URI of the Terms-of-Service for Let's Encrypt that has been accepted.- See Also:
TOS_ACCEPT_URI
The URI of the Terms-of-Service for Let's Encrypt that must be accepted.- See Also:
AUTO_ACCEPT
Flag for auto-accept.- See Also:
ALIAS
The alias for the certificate.- See Also:
DEFAULT_PASSWORD
Default password for keystore.- See Also:
CHALLENGE_TYPE
The type of challenge: HTTP or DNS.- See Also:
Constructor Details
LetsEncryptDomain
public LetsEncryptDomain()Creates the port configuration without a name. The name must be set in all cases using thesetPropertyAtom
call.LetsEncryptDomain
Creates the port configuration with a name.- Parameters:
atom
- The name of the property.
Method Details
clone
Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.onEventSelf
Change of password or keystore invalidates the existing keystore cached.- Specified by:
onEventSelf
in interfaceIGProp<GProp<?>[]>
- Overrides:
onEventSelf
in classGProp<GProp<?>[]>
- Parameters:
event
- The property event.
getKeyStorePassword
Gets the KeyStore password.- Returns:
- The password, "changeit" for default.
getKeyStore
public KeyStore getKeyStore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOExceptionGets the KeyStore from a PKCS#12 identity property and password.- Returns:
- The configured KeyStore, or null if not defined.
- Throws:
KeyStoreException
- If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.NoSuchAlgorithmException
- If the algorithm used to check the integrity of the KeyStore cannot be found.CertificateException
- If any of the certificates in the KeyStore could not be loaded.IOException
- If there is an I/O or format problem with the KeyStore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.
getKeyStore
public KeyStore getKeyStore(StringBuilder pwReturn) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException Gets the KeyStore from a PKCS#12 identity property and password.- Parameters:
pwReturn
- A StringBuilder instance that is filled with the password, null for none.- Returns:
- The configured KeyStore, or null if not defined.
- Throws:
KeyStoreException
- If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.NoSuchAlgorithmException
- If the algorithm used to check the integrity of the KeyStore cannot be found.CertificateException
- If any of the certificates in the KeyStore could not be loaded.IOException
- If there is an I/O or format problem with the KeyStore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.
updateIdentity
public boolean updateIdentity(File file, String password) throws UnrecoverableKeyException, FileNotFoundException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, PropException Updates the PKCS#12 identity from a file.- Parameters:
file
- The identity file.password
- The password, null for default "changeit".- Returns:
- true for changed, false for no change.
- Throws:
FileNotFoundException
- If the file is not found.NoSuchAlgorithmException
- If the algorithm used to check the integrity of the keystore cannot be found.CertificateException
- If any of the certificates in the keystore could not be loaded.IOException
- If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.UnrecoverableKeyException
- If the key cannot be recovered (e.g. the given password is wrong).KeyStoreException
PropException
getExpirationDayCount
public int getExpirationDayCount()Gets the number of days before certificate expiration when a new certificate is requested from Let's Encrypt.- Returns:
- The number of days in the range 1 to 89, default 7.
getExpirationDate
Gets the expiration date of the identities first certificate alias.- Returns:
- The date of expiry, or null if identity is not set or failed to load.
getDomain
Gets the domain name.- Returns:
- The domain name as e.g. "hello.example.com".
getDescription
Gets the description of the port configuration.- Returns:
- The description, or null for none.
getChallengeType
Gets the type of challenge: HTTP or DNS.- Returns:
- The challenge type, default is
LetsEncrypt.Type.HTTP
.
getTermsOfServiceURI
Gets the current Terms-of-Service agreement URI- Returns:
- The ToS URI, or null if not received yet.
isAutoAcceptTermsOfServiceEnabled
public boolean isAutoAcceptTermsOfServiceEnabled()Returns the auto-accept Terms-of-Service agreement flag.- Returns:
- true for auto-acceptance, false for manual acceptance.
acceptTermsOfService
Called to accept a Terms-of-Service agreement.- Parameters:
uri
- The ToS URI.- Returns:
- true if changed, false for no change.
- Throws:
NullPointerException
- Ifuri
is null.
getNeedToAcceptTermsOfServiceURI
Gets the Terms-of-Service agreement URI that needs to be accepted.- Returns:
- The URI, or null for none.
setNeedToAcceptTermsOfServiceURI
Gets the Terms-of-Service agreement URI that needs to be accepted.- Parameters:
uri
- The URI, never null.- Returns:
- true if changed, false for no change.
- Throws:
NullPointerException
- Ifuri
is null.
startRenewal
Starts the renewal processing for the server.- Parameters:
server
- The server.
getRenewalInstance
Gets the certificate renewal instance.- Returns:
- The renewal instance, or
null
if not started.
addConnectorReference
Adds a Jetty HTTP connector that references this domain.- Parameters:
config
- The port configuration.